@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.
Files changed (91) hide show
  1. package/build/lib/Hydrate.d.ts +2 -2
  2. package/build/lib/Hydrate.esm.js.map +1 -1
  3. package/build/lib/Hydrate.js.map +1 -1
  4. package/build/lib/Hydrate.mjs.map +1 -1
  5. package/build/lib/QueryClientProvider.d.ts +2 -2
  6. package/build/lib/QueryClientProvider.esm.js.map +1 -1
  7. package/build/lib/QueryClientProvider.js.map +1 -1
  8. package/build/lib/QueryClientProvider.mjs.map +1 -1
  9. package/build/lib/__tests__/utils.d.ts +2 -1
  10. package/build/lib/types.d.ts +2 -2
  11. package/build/lib/useBaseQuery.d.ts +2 -2
  12. package/build/lib/useBaseQuery.esm.js +1 -1
  13. package/build/lib/useBaseQuery.esm.js.map +1 -1
  14. package/build/lib/useBaseQuery.js +2 -2
  15. package/build/lib/useBaseQuery.js.map +1 -1
  16. package/build/lib/useBaseQuery.mjs +1 -1
  17. package/build/lib/useBaseQuery.mjs.map +1 -1
  18. package/build/lib/useInfiniteQuery.d.ts +2 -2
  19. package/build/lib/useInfiniteQuery.esm.js.map +1 -1
  20. package/build/lib/useInfiniteQuery.js.map +1 -1
  21. package/build/lib/useInfiniteQuery.mjs.map +1 -1
  22. package/build/lib/useIsFetching.d.ts +2 -2
  23. package/build/lib/useIsFetching.esm.js +1 -1
  24. package/build/lib/useIsFetching.esm.js.map +1 -1
  25. package/build/lib/useIsFetching.js +2 -2
  26. package/build/lib/useIsFetching.js.map +1 -1
  27. package/build/lib/useIsFetching.mjs +1 -1
  28. package/build/lib/useIsFetching.mjs.map +1 -1
  29. package/build/lib/useIsMutating.d.ts +2 -2
  30. package/build/lib/useIsMutating.esm.js +1 -1
  31. package/build/lib/useIsMutating.esm.js.map +1 -1
  32. package/build/lib/useIsMutating.js +2 -2
  33. package/build/lib/useIsMutating.js.map +1 -1
  34. package/build/lib/useIsMutating.mjs +1 -1
  35. package/build/lib/useIsMutating.mjs.map +1 -1
  36. package/build/lib/useMutation.d.ts +2 -2
  37. package/build/lib/useMutation.esm.js +1 -1
  38. package/build/lib/useMutation.esm.js.map +1 -1
  39. package/build/lib/useMutation.js +2 -2
  40. package/build/lib/useMutation.js.map +1 -1
  41. package/build/lib/useMutation.mjs +1 -1
  42. package/build/lib/useMutation.mjs.map +1 -1
  43. package/build/lib/useQueries.d.ts +2 -2
  44. package/build/lib/useQueries.esm.js +1 -1
  45. package/build/lib/useQueries.esm.js.map +1 -1
  46. package/build/lib/useQueries.js +2 -2
  47. package/build/lib/useQueries.js.map +1 -1
  48. package/build/lib/useQueries.mjs +1 -1
  49. package/build/lib/useQueries.mjs.map +1 -1
  50. package/build/lib/useQuery.d.ts +2 -2
  51. package/build/lib/useQuery.esm.js.map +1 -1
  52. package/build/lib/useQuery.js.map +1 -1
  53. package/build/lib/useQuery.mjs.map +1 -1
  54. package/build/lib/useSyncExternalStore.d.ts +2 -1
  55. package/build/lib/useSyncExternalStore.esm.js +7 -0
  56. package/build/lib/useSyncExternalStore.esm.js.map +1 -0
  57. package/build/lib/useSyncExternalStore.js +11 -0
  58. package/build/lib/useSyncExternalStore.js.map +1 -0
  59. package/build/lib/useSyncExternalStore.mjs +7 -0
  60. package/build/lib/useSyncExternalStore.mjs.map +1 -0
  61. package/build/lib/useSyncExternalStore.native.d.ts +2 -1
  62. package/build/lib/useSyncExternalStore.native.esm.js +2 -0
  63. package/build/lib/useSyncExternalStore.native.esm.js.map +1 -0
  64. package/build/lib/useSyncExternalStore.native.js +13 -0
  65. package/build/lib/useSyncExternalStore.native.js.map +1 -0
  66. package/build/lib/useSyncExternalStore.native.mjs +2 -0
  67. package/build/lib/useSyncExternalStore.native.mjs.map +1 -0
  68. package/build/umd/index.development.js +8 -5
  69. package/build/umd/index.development.js.map +1 -1
  70. package/build/umd/index.production.js +1 -1
  71. package/build/umd/index.production.js.map +1 -1
  72. package/package.json +2 -2
  73. package/src/Hydrate.tsx +3 -2
  74. package/src/QueryClientProvider.tsx +2 -2
  75. package/src/__tests__/suspense.test.tsx +1 -2
  76. package/src/__tests__/useInfiniteQuery.test.tsx +2 -3
  77. package/src/__tests__/useIsFetching.test.tsx +2 -1
  78. package/src/__tests__/useMutation.test.tsx +3 -2
  79. package/src/__tests__/useQueries.test.tsx +3 -5
  80. package/src/__tests__/useQuery.test.tsx +2 -3
  81. package/src/__tests__/utils.tsx +2 -7
  82. package/src/types.ts +2 -2
  83. package/src/useBaseQuery.ts +3 -2
  84. package/src/useInfiniteQuery.ts +3 -4
  85. package/src/useIsFetching.ts +3 -7
  86. package/src/useIsMutating.ts +3 -7
  87. package/src/useMutation.ts +2 -3
  88. package/src/useQueries.ts +3 -7
  89. package/src/useQuery.ts +7 -7
  90. package/src/useSyncExternalStore.native.ts +3 -1
  91. package/src/useSyncExternalStore.ts +3 -1
@@ -1 +1,2 @@
1
- export { useSyncExternalStore } from 'use-sync-external-store/shim/index.native.js';
1
+ import { useSyncExternalStore } from 'use-sync-external-store/shim/index.native.js';
2
+ export { useSyncExternalStore };
@@ -0,0 +1,2 @@
1
+ export { useSyncExternalStore } from 'use-sync-external-store/shim/index.native.js';
2
+ //# sourceMappingURL=useSyncExternalStore.native.esm.js.map
@@ -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,2 @@
1
+ export { useSyncExternalStore } from 'use-sync-external-store/shim/index.native.js';
2
+ //# sourceMappingURL=useSyncExternalStore.native.mjs.map
@@ -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
- shim.exports.useSyncExternalStore(React__namespace.useCallback(onStoreChange => isRestoring ? () => undefined : observer.subscribe(notifyManager.batchCalls(onStoreChange)), [observer, isRestoring]), () => observer.getCurrentResult(), () => observer.getCurrentResult());
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
- shim.exports.useSyncExternalStore(React__namespace.useCallback(onStoreChange => isRestoring ? () => undefined : observer.subscribe(notifyManager.batchCalls(onStoreChange)), [observer, isRestoring]), () => observer.getCurrentResult(), () => observer.getCurrentResult());
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 shim.exports.useSyncExternalStore(React__namespace.useCallback(onStoreChange => queryCache.subscribe(notifyManager.batchCalls(onStoreChange)), [queryCache]), () => queryClient.isFetching(filters), () => queryClient.isFetching(filters));
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 shim.exports.useSyncExternalStore(React__namespace.useCallback(onStoreChange => mutationCache.subscribe(notifyManager.batchCalls(onStoreChange)), [mutationCache]), () => queryClient.isMutating(filters), () => queryClient.isMutating(filters));
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 = shim.exports.useSyncExternalStore(React__namespace.useCallback(onStoreChange => observer.subscribe(notifyManager.batchCalls(onStoreChange)), [observer]), () => observer.getCurrentResult(), () => observer.getCurrentResult());
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]);