File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,20 @@ export function createBaseQuery<
6363 ) => {
6464 return observer . subscribe ( ( result ) => {
6565 notifyManager . batchCalls ( ( ) => {
66- const unwrappedResult = { ...unwrap ( result ) }
66+ const query = observer . getCurrentQuery ( )
67+ const unwrappedResult = {
68+ ...unwrap ( result ) ,
69+
70+ // hydrate() expects a QueryState object, which is similar but not
71+ // quite the same as a QueryObserverResult object. Thus, for now, we're
72+ // copying over the missing properties from state in order to support hydration
73+ dataUpdateCount : query . state . dataUpdateCount ,
74+ fetchFailureCount : query . state . fetchFailureCount ,
75+ fetchFailureReason : query . state . fetchFailureReason ,
76+ fetchMeta : query . state . fetchMeta ,
77+ isInvalidated : query . state . isInvalidated ,
78+ }
79+
6780 if ( unwrappedResult . isError ) {
6881 if ( process . env [ 'NODE_ENV' ] === 'development' ) {
6982 console . error ( unwrappedResult . error )
You can’t perform that action at this time.
0 commit comments