@tanstack/react-query 4.35.0 → 4.35.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/umd/index.development.js +24 -14
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/build/lib/Hydrate.d.ts.map +0 -1
- package/build/lib/QueryClientProvider.d.ts.map +0 -1
- package/build/lib/QueryErrorResetBoundary.d.ts.map +0 -1
- package/build/lib/__tests__/Hydrate.test.d.ts.map +0 -1
- package/build/lib/__tests__/QueryClientProvider.test.d.ts.map +0 -1
- package/build/lib/__tests__/QueryResetErrorBoundary.test.d.ts.map +0 -1
- package/build/lib/__tests__/ssr-hydration.test.d.ts.map +0 -1
- package/build/lib/__tests__/ssr.test.d.ts.map +0 -1
- package/build/lib/__tests__/suspense.test.d.ts.map +0 -1
- package/build/lib/__tests__/useInfiniteQuery.test.d.ts.map +0 -1
- package/build/lib/__tests__/useIsFetching.test.d.ts.map +0 -1
- package/build/lib/__tests__/useIsMutating.test.d.ts.map +0 -1
- package/build/lib/__tests__/useMutation.test.d.ts.map +0 -1
- package/build/lib/__tests__/useQueries.test.d.ts.map +0 -1
- package/build/lib/__tests__/useQuery.test.d.ts.map +0 -1
- package/build/lib/__tests__/useQuery.types.test.d.ts.map +0 -1
- package/build/lib/__tests__/utils.d.ts.map +0 -1
- package/build/lib/errorBoundaryUtils.d.ts.map +0 -1
- package/build/lib/index.d.ts.map +0 -1
- package/build/lib/isRestoring.d.ts.map +0 -1
- package/build/lib/reactBatchedUpdates.d.ts.map +0 -1
- package/build/lib/reactBatchedUpdates.native.d.ts.map +0 -1
- package/build/lib/setBatchUpdatesFn.d.ts.map +0 -1
- package/build/lib/suspense.d.ts.map +0 -1
- package/build/lib/types.d.ts.map +0 -1
- package/build/lib/useBaseQuery.d.ts.map +0 -1
- package/build/lib/useInfiniteQuery.d.ts.map +0 -1
- package/build/lib/useIsFetching.d.ts.map +0 -1
- package/build/lib/useIsMutating.d.ts.map +0 -1
- package/build/lib/useMutation.d.ts.map +0 -1
- package/build/lib/useQueries.d.ts.map +0 -1
- package/build/lib/useQuery.d.ts.map +0 -1
- package/build/lib/useSyncExternalStore.d.ts.map +0 -1
- package/build/lib/useSyncExternalStore.native.d.ts.map +0 -1
- package/build/lib/utils.d.ts.map +0 -1
|
@@ -1044,8 +1044,8 @@
|
|
|
1044
1044
|
}
|
|
1045
1045
|
}
|
|
1046
1046
|
|
|
1047
|
-
|
|
1048
|
-
{
|
|
1047
|
+
{
|
|
1048
|
+
if (!Array.isArray(this.options.queryKey)) {
|
|
1049
1049
|
this.logger.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']");
|
|
1050
1050
|
}
|
|
1051
1051
|
}
|
|
@@ -1242,7 +1242,8 @@
|
|
|
1242
1242
|
const error = action.error;
|
|
1243
1243
|
|
|
1244
1244
|
if (isCancelledError(error) && error.revert && this.revertState) {
|
|
1245
|
-
return { ...this.revertState
|
|
1245
|
+
return { ...this.revertState,
|
|
1246
|
+
fetchStatus: 'idle'
|
|
1246
1247
|
};
|
|
1247
1248
|
}
|
|
1248
1249
|
|
|
@@ -3262,18 +3263,23 @@
|
|
|
3262
3263
|
mutationKey: dehydratedMutation.mutationKey
|
|
3263
3264
|
}, dehydratedMutation.state);
|
|
3264
3265
|
});
|
|
3265
|
-
queries.forEach(
|
|
3266
|
+
queries.forEach(({
|
|
3267
|
+
queryKey,
|
|
3268
|
+
state,
|
|
3269
|
+
queryHash
|
|
3270
|
+
}) => {
|
|
3266
3271
|
var _options$defaultOptio2;
|
|
3267
3272
|
|
|
3268
|
-
const query = queryCache.get(
|
|
3269
|
-
// query being stuck in fetching state upon hydration
|
|
3270
|
-
|
|
3271
|
-
const dehydratedQueryState = { ...dehydratedQuery.state,
|
|
3272
|
-
fetchStatus: 'idle'
|
|
3273
|
-
}; // Do not hydrate if an existing query exists with newer data
|
|
3273
|
+
const query = queryCache.get(queryHash); // Do not hydrate if an existing query exists with newer data
|
|
3274
3274
|
|
|
3275
3275
|
if (query) {
|
|
3276
|
-
if (query.state.dataUpdatedAt <
|
|
3276
|
+
if (query.state.dataUpdatedAt < state.dataUpdatedAt) {
|
|
3277
|
+
// omit fetchStatus from dehydrated state
|
|
3278
|
+
// so that query stays in its current fetchStatus
|
|
3279
|
+
const {
|
|
3280
|
+
fetchStatus: _ignored,
|
|
3281
|
+
...dehydratedQueryState
|
|
3282
|
+
} = state;
|
|
3277
3283
|
query.setState(dehydratedQueryState);
|
|
3278
3284
|
}
|
|
3279
3285
|
|
|
@@ -3282,9 +3288,13 @@
|
|
|
3282
3288
|
|
|
3283
3289
|
|
|
3284
3290
|
queryCache.build(client, { ...(options == null ? void 0 : (_options$defaultOptio2 = options.defaultOptions) == null ? void 0 : _options$defaultOptio2.queries),
|
|
3285
|
-
queryKey
|
|
3286
|
-
queryHash
|
|
3287
|
-
},
|
|
3291
|
+
queryKey,
|
|
3292
|
+
queryHash
|
|
3293
|
+
}, // Reset fetch status to idle to avoid
|
|
3294
|
+
// query being stuck in fetching state upon hydration
|
|
3295
|
+
{ ...state,
|
|
3296
|
+
fetchStatus: 'idle'
|
|
3297
|
+
});
|
|
3288
3298
|
});
|
|
3289
3299
|
}
|
|
3290
3300
|
|