@tanstack/react-query 4.3.8 → 4.4.0
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/lib/Hydrate.d.ts +2 -2
- package/build/lib/Hydrate.esm.js.map +1 -1
- package/build/lib/Hydrate.js.map +1 -1
- package/build/lib/Hydrate.mjs.map +1 -1
- package/build/lib/QueryClientProvider.d.ts +2 -2
- package/build/lib/QueryClientProvider.esm.js.map +1 -1
- package/build/lib/QueryClientProvider.js.map +1 -1
- package/build/lib/QueryClientProvider.mjs.map +1 -1
- package/build/lib/__tests__/utils.d.ts +2 -1
- package/build/lib/types.d.ts +2 -2
- package/build/lib/useBaseQuery.d.ts +2 -2
- package/build/lib/useBaseQuery.esm.js +1 -1
- package/build/lib/useBaseQuery.esm.js.map +1 -1
- package/build/lib/useBaseQuery.js +2 -2
- package/build/lib/useBaseQuery.js.map +1 -1
- package/build/lib/useBaseQuery.mjs +1 -1
- package/build/lib/useBaseQuery.mjs.map +1 -1
- package/build/lib/useInfiniteQuery.d.ts +2 -2
- package/build/lib/useInfiniteQuery.esm.js.map +1 -1
- package/build/lib/useInfiniteQuery.js.map +1 -1
- package/build/lib/useInfiniteQuery.mjs.map +1 -1
- package/build/lib/useIsFetching.d.ts +2 -2
- package/build/lib/useIsFetching.esm.js +1 -1
- package/build/lib/useIsFetching.esm.js.map +1 -1
- package/build/lib/useIsFetching.js +2 -2
- package/build/lib/useIsFetching.js.map +1 -1
- package/build/lib/useIsFetching.mjs +1 -1
- package/build/lib/useIsFetching.mjs.map +1 -1
- package/build/lib/useIsMutating.d.ts +2 -2
- package/build/lib/useIsMutating.esm.js +1 -1
- package/build/lib/useIsMutating.esm.js.map +1 -1
- package/build/lib/useIsMutating.js +2 -2
- package/build/lib/useIsMutating.js.map +1 -1
- package/build/lib/useIsMutating.mjs +1 -1
- package/build/lib/useIsMutating.mjs.map +1 -1
- package/build/lib/useMutation.d.ts +2 -2
- package/build/lib/useMutation.esm.js +1 -1
- package/build/lib/useMutation.esm.js.map +1 -1
- package/build/lib/useMutation.js +2 -2
- package/build/lib/useMutation.js.map +1 -1
- package/build/lib/useMutation.mjs +1 -1
- package/build/lib/useMutation.mjs.map +1 -1
- package/build/lib/useQueries.d.ts +2 -2
- package/build/lib/useQueries.esm.js +1 -1
- package/build/lib/useQueries.esm.js.map +1 -1
- package/build/lib/useQueries.js +2 -2
- package/build/lib/useQueries.js.map +1 -1
- package/build/lib/useQueries.mjs +1 -1
- package/build/lib/useQueries.mjs.map +1 -1
- package/build/lib/useQuery.d.ts +2 -2
- package/build/lib/useQuery.esm.js.map +1 -1
- package/build/lib/useQuery.js.map +1 -1
- package/build/lib/useQuery.mjs.map +1 -1
- package/build/lib/useSyncExternalStore.d.ts +2 -1
- package/build/lib/useSyncExternalStore.esm.js +7 -0
- package/build/lib/useSyncExternalStore.esm.js.map +1 -0
- package/build/lib/useSyncExternalStore.js +11 -0
- package/build/lib/useSyncExternalStore.js.map +1 -0
- package/build/lib/useSyncExternalStore.mjs +7 -0
- package/build/lib/useSyncExternalStore.mjs.map +1 -0
- package/build/lib/useSyncExternalStore.native.d.ts +2 -1
- package/build/lib/useSyncExternalStore.native.esm.js +2 -0
- package/build/lib/useSyncExternalStore.native.esm.js.map +1 -0
- package/build/lib/useSyncExternalStore.native.js +13 -0
- package/build/lib/useSyncExternalStore.native.js.map +1 -0
- package/build/lib/useSyncExternalStore.native.mjs +2 -0
- package/build/lib/useSyncExternalStore.native.mjs.map +1 -0
- package/build/umd/index.development.js +8 -5
- 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/src/Hydrate.tsx +3 -2
- package/src/QueryClientProvider.tsx +2 -2
- package/src/__tests__/suspense.test.tsx +1 -2
- package/src/__tests__/useInfiniteQuery.test.tsx +2 -3
- package/src/__tests__/useIsFetching.test.tsx +2 -1
- package/src/__tests__/useMutation.test.tsx +3 -2
- package/src/__tests__/useQueries.test.tsx +3 -5
- package/src/__tests__/useQuery.test.tsx +2 -3
- package/src/__tests__/utils.tsx +2 -7
- package/src/types.ts +2 -2
- package/src/useBaseQuery.ts +3 -2
- package/src/useInfiniteQuery.ts +3 -4
- package/src/useIsFetching.ts +3 -7
- package/src/useIsMutating.ts +3 -7
- package/src/useMutation.ts +2 -3
- package/src/useQueries.ts +3 -7
- package/src/useQuery.ts +7 -7
- package/src/useSyncExternalStore.native.ts +3 -1
- package/src/useSyncExternalStore.ts +3 -1
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { useSyncExternalStore } from 'use-sync-external-store/shim/index.native.js';
|
|
2
|
+
export { useSyncExternalStore };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSyncExternalStore.native.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var index_native_js = require('use-sync-external-store/shim/index.native.js');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, 'useSyncExternalStore', {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return index_native_js.useSyncExternalStore; }
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=useSyncExternalStore.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSyncExternalStore.native.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSyncExternalStore.native.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -3367,6 +3367,9 @@
|
|
|
3367
3367
|
}
|
|
3368
3368
|
} (shim));
|
|
3369
3369
|
|
|
3370
|
+
// Temporary workaround due to an issue with react-native uSES - https://github.com/TanStack/query/pull/3601
|
|
3371
|
+
const useSyncExternalStore = shim.exports.useSyncExternalStore;
|
|
3372
|
+
|
|
3370
3373
|
const defaultContext = /*#__PURE__*/React__namespace.createContext(undefined);
|
|
3371
3374
|
const QueryClientSharingContext = /*#__PURE__*/React__namespace.createContext(false); // If we are given a context, we will use it.
|
|
3372
3375
|
// Otherwise, if contextSharing is on, we share the first and at least one
|
|
@@ -3445,7 +3448,7 @@
|
|
|
3445
3448
|
}), [queries, queryClient, isRestoring]);
|
|
3446
3449
|
const [observer] = React__namespace.useState(() => new QueriesObserver(queryClient, defaultedQueries));
|
|
3447
3450
|
const result = observer.getOptimisticResult(defaultedQueries);
|
|
3448
|
-
|
|
3451
|
+
useSyncExternalStore(React__namespace.useCallback(onStoreChange => isRestoring ? () => undefined : observer.subscribe(notifyManager.batchCalls(onStoreChange)), [observer, isRestoring]), () => observer.getCurrentResult(), () => observer.getCurrentResult());
|
|
3449
3452
|
React__namespace.useEffect(() => {
|
|
3450
3453
|
// Do not notify on updates because of changes in the options because
|
|
3451
3454
|
// these changes should already be reflected in the optimistic result.
|
|
@@ -3532,7 +3535,7 @@
|
|
|
3532
3535
|
|
|
3533
3536
|
const [observer] = React__namespace.useState(() => new Observer(queryClient, defaultedOptions));
|
|
3534
3537
|
const result = observer.getOptimisticResult(defaultedOptions);
|
|
3535
|
-
|
|
3538
|
+
useSyncExternalStore(React__namespace.useCallback(onStoreChange => isRestoring ? () => undefined : observer.subscribe(notifyManager.batchCalls(onStoreChange)), [observer, isRestoring]), () => observer.getCurrentResult(), () => observer.getCurrentResult());
|
|
3536
3539
|
React__namespace.useEffect(() => {
|
|
3537
3540
|
errorResetBoundary.clearReset();
|
|
3538
3541
|
}, [errorResetBoundary]);
|
|
@@ -3602,7 +3605,7 @@
|
|
|
3602
3605
|
context: options.context
|
|
3603
3606
|
});
|
|
3604
3607
|
const queryCache = queryClient.getQueryCache();
|
|
3605
|
-
return
|
|
3608
|
+
return useSyncExternalStore(React__namespace.useCallback(onStoreChange => queryCache.subscribe(notifyManager.batchCalls(onStoreChange)), [queryCache]), () => queryClient.isFetching(filters), () => queryClient.isFetching(filters));
|
|
3606
3609
|
}
|
|
3607
3610
|
|
|
3608
3611
|
function useIsMutating(arg1, arg2, arg3) {
|
|
@@ -3611,7 +3614,7 @@
|
|
|
3611
3614
|
context: options.context
|
|
3612
3615
|
});
|
|
3613
3616
|
const mutationCache = queryClient.getMutationCache();
|
|
3614
|
-
return
|
|
3617
|
+
return useSyncExternalStore(React__namespace.useCallback(onStoreChange => mutationCache.subscribe(notifyManager.batchCalls(onStoreChange)), [mutationCache]), () => queryClient.isMutating(filters), () => queryClient.isMutating(filters));
|
|
3615
3618
|
}
|
|
3616
3619
|
|
|
3617
3620
|
function useMutation(arg1, arg2, arg3) {
|
|
@@ -3623,7 +3626,7 @@
|
|
|
3623
3626
|
React__namespace.useEffect(() => {
|
|
3624
3627
|
observer.setOptions(options);
|
|
3625
3628
|
}, [observer, options]);
|
|
3626
|
-
const result =
|
|
3629
|
+
const result = useSyncExternalStore(React__namespace.useCallback(onStoreChange => observer.subscribe(notifyManager.batchCalls(onStoreChange)), [observer]), () => observer.getCurrentResult(), () => observer.getCurrentResult());
|
|
3627
3630
|
const mutate = React__namespace.useCallback((variables, mutateOptions) => {
|
|
3628
3631
|
observer.mutate(variables, mutateOptions).catch(noop);
|
|
3629
3632
|
}, [observer]);
|