@tanstack/react-query 4.24.10 → 5.0.0-alpha.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 (199) hide show
  1. package/build/lib/HydrationBoundary.d.ts +9 -0
  2. package/build/lib/{Hydrate.esm.js → HydrationBoundary.esm.js} +14 -17
  3. package/build/lib/HydrationBoundary.esm.js.map +1 -0
  4. package/build/lib/{Hydrate.js → HydrationBoundary.js} +17 -24
  5. package/build/lib/HydrationBoundary.js.map +1 -0
  6. package/build/lib/{Hydrate.mjs → HydrationBoundary.mjs} +14 -17
  7. package/build/lib/HydrationBoundary.mjs.map +1 -0
  8. package/build/lib/QueryClientProvider.d.ts +4 -19
  9. package/build/lib/QueryClientProvider.esm.js +11 -46
  10. package/build/lib/QueryClientProvider.esm.js.map +1 -1
  11. package/build/lib/QueryClientProvider.js +14 -52
  12. package/build/lib/QueryClientProvider.js.map +1 -1
  13. package/build/lib/QueryClientProvider.mjs +11 -46
  14. package/build/lib/QueryClientProvider.mjs.map +1 -1
  15. package/build/lib/QueryErrorResetBoundary.esm.js +7 -2
  16. package/build/lib/QueryErrorResetBoundary.esm.js.map +1 -1
  17. package/build/lib/QueryErrorResetBoundary.js +10 -8
  18. package/build/lib/QueryErrorResetBoundary.js.map +1 -1
  19. package/build/lib/QueryErrorResetBoundary.mjs +7 -2
  20. package/build/lib/QueryErrorResetBoundary.mjs.map +1 -1
  21. package/build/lib/__tests__/useQuery.types.test.d.ts +1 -2
  22. package/build/lib/__tests__/utils.d.ts +7 -10
  23. package/build/lib/errorBoundaryUtils.d.ts +3 -3
  24. package/build/lib/errorBoundaryUtils.esm.js +3 -3
  25. package/build/lib/errorBoundaryUtils.esm.js.map +1 -1
  26. package/build/lib/errorBoundaryUtils.js +6 -9
  27. package/build/lib/errorBoundaryUtils.js.map +1 -1
  28. package/build/lib/errorBoundaryUtils.mjs +3 -3
  29. package/build/lib/errorBoundaryUtils.mjs.map +1 -1
  30. package/build/lib/index.d.ts +4 -5
  31. package/build/lib/index.esm.js +3 -4
  32. package/build/lib/index.esm.js.map +1 -1
  33. package/build/lib/index.js +6 -9
  34. package/build/lib/index.js.map +1 -1
  35. package/build/lib/index.mjs +3 -4
  36. package/build/lib/index.mjs.map +1 -1
  37. package/build/lib/isRestoring.esm.js.map +1 -1
  38. package/build/lib/isRestoring.js +3 -6
  39. package/build/lib/isRestoring.js.map +1 -1
  40. package/build/lib/isRestoring.mjs.map +1 -1
  41. package/build/lib/suspense.esm.js +5 -5
  42. package/build/lib/suspense.esm.js.map +1 -1
  43. package/build/lib/suspense.js +5 -7
  44. package/build/lib/suspense.js.map +1 -1
  45. package/build/lib/suspense.mjs +5 -5
  46. package/build/lib/suspense.mjs.map +1 -1
  47. package/build/lib/types.d.ts +14 -22
  48. package/build/lib/useBaseQuery.d.ts +2 -2
  49. package/build/lib/useBaseQuery.esm.js +15 -18
  50. package/build/lib/useBaseQuery.esm.js.map +1 -1
  51. package/build/lib/useBaseQuery.js +18 -24
  52. package/build/lib/useBaseQuery.js.map +1 -1
  53. package/build/lib/useBaseQuery.mjs +15 -18
  54. package/build/lib/useBaseQuery.mjs.map +1 -1
  55. package/build/lib/useInfiniteQuery.d.ts +2 -4
  56. package/build/lib/useInfiniteQuery.esm.js +4 -4
  57. package/build/lib/useInfiniteQuery.esm.js.map +1 -1
  58. package/build/lib/useInfiniteQuery.js +3 -5
  59. package/build/lib/useInfiniteQuery.js.map +1 -1
  60. package/build/lib/useInfiniteQuery.mjs +4 -4
  61. package/build/lib/useInfiniteQuery.mjs.map +1 -1
  62. package/build/lib/useIsFetching.d.ts +2 -7
  63. package/build/lib/useIsFetching.esm.js +5 -9
  64. package/build/lib/useIsFetching.esm.js.map +1 -1
  65. package/build/lib/useIsFetching.js +7 -14
  66. package/build/lib/useIsFetching.js.map +1 -1
  67. package/build/lib/useIsFetching.mjs +5 -9
  68. package/build/lib/useIsFetching.mjs.map +1 -1
  69. package/build/lib/useMutation.d.ts +2 -5
  70. package/build/lib/useMutation.esm.js +12 -14
  71. package/build/lib/useMutation.esm.js.map +1 -1
  72. package/build/lib/useMutation.js +14 -19
  73. package/build/lib/useMutation.js.map +1 -1
  74. package/build/lib/useMutation.mjs +12 -14
  75. package/build/lib/useMutation.mjs.map +1 -1
  76. package/build/lib/useMutationState.d.ts +8 -0
  77. package/build/lib/useMutationState.esm.js +37 -0
  78. package/build/lib/useMutationState.esm.js.map +1 -0
  79. package/build/lib/useMutationState.js +59 -0
  80. package/build/lib/useMutationState.js.map +1 -0
  81. package/build/lib/useMutationState.mjs +37 -0
  82. package/build/lib/useMutationState.mjs.map +1 -0
  83. package/build/lib/useQueries.d.ts +9 -7
  84. package/build/lib/useQueries.esm.js +16 -27
  85. package/build/lib/useQueries.esm.js.map +1 -1
  86. package/build/lib/useQueries.js +19 -33
  87. package/build/lib/useQueries.js.map +1 -1
  88. package/build/lib/useQueries.mjs +16 -27
  89. package/build/lib/useQueries.mjs.map +1 -1
  90. package/build/lib/useQuery.d.ts +9 -21
  91. package/build/lib/useQuery.esm.js +5 -4
  92. package/build/lib/useQuery.esm.js.map +1 -1
  93. package/build/lib/useQuery.js +4 -5
  94. package/build/lib/useQuery.js.map +1 -1
  95. package/build/lib/useQuery.mjs +5 -4
  96. package/build/lib/useQuery.mjs.map +1 -1
  97. package/build/lib/utils.d.ts +1 -1
  98. package/build/lib/utils.esm.js +5 -6
  99. package/build/lib/utils.esm.js.map +1 -1
  100. package/build/lib/utils.js +5 -8
  101. package/build/lib/utils.js.map +1 -1
  102. package/build/lib/utils.mjs +5 -6
  103. package/build/lib/utils.mjs.map +1 -1
  104. package/build/umd/index.development.js +1003 -1827
  105. package/build/umd/index.development.js.map +1 -1
  106. package/build/umd/index.production.js +1 -1
  107. package/build/umd/index.production.js.map +1 -1
  108. package/package.json +6 -18
  109. package/src/{Hydrate.tsx → HydrationBoundary.tsx} +17 -18
  110. package/src/QueryClientProvider.tsx +11 -65
  111. package/src/__tests__/{Hydrate.test.tsx → HydrationBoundary.test.tsx} +89 -77
  112. package/src/__tests__/QueryClientProvider.test.tsx +33 -147
  113. package/src/__tests__/QueryResetErrorBoundary.test.tsx +118 -85
  114. package/src/__tests__/ssr-hydration.test.tsx +27 -33
  115. package/src/__tests__/ssr.test.tsx +23 -9
  116. package/src/__tests__/suspense.test.tsx +194 -171
  117. package/src/__tests__/useInfiniteQuery.test.tsx +249 -494
  118. package/src/__tests__/useInfiniteQuery.type.test.tsx +131 -0
  119. package/src/__tests__/useIsFetching.test.tsx +65 -108
  120. package/src/__tests__/useMutation.test.tsx +200 -268
  121. package/src/__tests__/useMutationState.test.tsx +284 -0
  122. package/src/__tests__/useQueries.test.tsx +43 -347
  123. package/src/__tests__/useQuery.test.tsx +890 -686
  124. package/src/__tests__/useQuery.types.test.tsx +23 -24
  125. package/src/__tests__/utils.tsx +14 -23
  126. package/src/errorBoundaryUtils.ts +5 -10
  127. package/src/index.ts +4 -7
  128. package/src/types.ts +33 -38
  129. package/src/useBaseQuery.ts +7 -7
  130. package/src/useInfiniteQuery.ts +12 -77
  131. package/src/useIsFetching.ts +8 -20
  132. package/src/useMutation.ts +8 -66
  133. package/src/useMutationState.ts +81 -0
  134. package/src/useQueries.ts +29 -21
  135. package/src/useQuery.ts +27 -104
  136. package/src/utils.ts +5 -5
  137. package/build/lib/Hydrate.d.ts +0 -10
  138. package/build/lib/Hydrate.esm.js.map +0 -1
  139. package/build/lib/Hydrate.js.map +0 -1
  140. package/build/lib/Hydrate.mjs.map +0 -1
  141. package/build/lib/reactBatchedUpdates.d.ts +0 -2
  142. package/build/lib/reactBatchedUpdates.esm.js +0 -6
  143. package/build/lib/reactBatchedUpdates.esm.js.map +0 -1
  144. package/build/lib/reactBatchedUpdates.js +0 -30
  145. package/build/lib/reactBatchedUpdates.js.map +0 -1
  146. package/build/lib/reactBatchedUpdates.mjs +0 -6
  147. package/build/lib/reactBatchedUpdates.mjs.map +0 -1
  148. package/build/lib/reactBatchedUpdates.native.d.ts +0 -2
  149. package/build/lib/reactBatchedUpdates.native.esm.js +0 -2
  150. package/build/lib/reactBatchedUpdates.native.esm.js.map +0 -1
  151. package/build/lib/reactBatchedUpdates.native.js +0 -13
  152. package/build/lib/reactBatchedUpdates.native.js.map +0 -1
  153. package/build/lib/reactBatchedUpdates.native.mjs +0 -2
  154. package/build/lib/reactBatchedUpdates.native.mjs.map +0 -1
  155. package/build/lib/setBatchUpdatesFn.esm.js +0 -5
  156. package/build/lib/setBatchUpdatesFn.esm.js.map +0 -1
  157. package/build/lib/setBatchUpdatesFn.js +0 -7
  158. package/build/lib/setBatchUpdatesFn.js.map +0 -1
  159. package/build/lib/setBatchUpdatesFn.mjs +0 -5
  160. package/build/lib/setBatchUpdatesFn.mjs.map +0 -1
  161. package/build/lib/useIsMutating.d.ts +0 -7
  162. package/build/lib/useIsMutating.esm.js +0 -16
  163. package/build/lib/useIsMutating.esm.js.map +0 -1
  164. package/build/lib/useIsMutating.js +0 -40
  165. package/build/lib/useIsMutating.js.map +0 -1
  166. package/build/lib/useIsMutating.mjs +0 -16
  167. package/build/lib/useIsMutating.mjs.map +0 -1
  168. package/build/lib/useSyncExternalStore.d.ts +0 -2
  169. package/build/lib/useSyncExternalStore.esm.js +0 -7
  170. package/build/lib/useSyncExternalStore.esm.js.map +0 -1
  171. package/build/lib/useSyncExternalStore.js +0 -11
  172. package/build/lib/useSyncExternalStore.js.map +0 -1
  173. package/build/lib/useSyncExternalStore.mjs +0 -7
  174. package/build/lib/useSyncExternalStore.mjs.map +0 -1
  175. package/build/lib/useSyncExternalStore.native.d.ts +0 -2
  176. package/build/lib/useSyncExternalStore.native.esm.js +0 -2
  177. package/build/lib/useSyncExternalStore.native.esm.js.map +0 -1
  178. package/build/lib/useSyncExternalStore.native.js +0 -13
  179. package/build/lib/useSyncExternalStore.native.js.map +0 -1
  180. package/build/lib/useSyncExternalStore.native.mjs +0 -2
  181. package/build/lib/useSyncExternalStore.native.mjs.map +0 -1
  182. package/codemods/v4/key-transformation.js +0 -138
  183. package/codemods/v4/replace-import-specifier.js +0 -25
  184. package/codemods/v4/utils/index.js +0 -166
  185. package/codemods/v4/utils/replacers/key-replacer.js +0 -160
  186. package/codemods/v4/utils/transformers/query-cache-transformer.js +0 -115
  187. package/codemods/v4/utils/transformers/query-client-transformer.js +0 -49
  188. package/codemods/v4/utils/transformers/use-query-like-transformer.js +0 -32
  189. package/codemods/v4/utils/unprocessable-key-error.js +0 -8
  190. package/src/__tests__/useIsMutating.test.tsx +0 -259
  191. package/src/reactBatchedUpdates.native.ts +0 -4
  192. package/src/reactBatchedUpdates.ts +0 -2
  193. package/src/setBatchUpdatesFn.ts +0 -4
  194. package/src/useIsMutating.ts +0 -39
  195. package/src/useSyncExternalStore.native.ts +0 -5
  196. package/src/useSyncExternalStore.ts +0 -4
  197. /package/build/lib/__tests__/{Hydrate.test.d.ts → HydrationBoundary.test.d.ts} +0 -0
  198. /package/build/lib/__tests__/{useIsMutating.test.d.ts → useInfiniteQuery.type.test.d.ts} +0 -0
  199. /package/build/lib/{setBatchUpdatesFn.d.ts → __tests__/useMutationState.test.d.ts} +0 -0
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+ import type { HydrateOptions, QueryClient } from '@tanstack/query-core';
3
+ export interface HydrationBoundaryProps {
4
+ state?: unknown;
5
+ options?: HydrateOptions;
6
+ children?: React.ReactNode;
7
+ queryClient?: QueryClient;
8
+ }
9
+ export declare const HydrationBoundary: ({ children, options, state, queryClient, }: HydrationBoundaryProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
@@ -2,30 +2,27 @@ import * as React from 'react';
2
2
  import { hydrate } from '@tanstack/query-core';
3
3
  import { useQueryClient } from './QueryClientProvider.esm.js';
4
4
 
5
- function useHydrate(state, options = {}) {
6
- const queryClient = useQueryClient({
7
- context: options.context
8
- });
5
+ const HydrationBoundary = ({
6
+ children,
7
+ options = {},
8
+ state,
9
+ queryClient
10
+ }) => {
11
+ const client = useQueryClient(queryClient);
9
12
  const optionsRef = React.useRef(options);
10
- optionsRef.current = options; // Running hydrate again with the same queries is safe,
13
+ optionsRef.current = options;
14
+
15
+ // Running hydrate again with the same queries is safe,
11
16
  // it wont overwrite or initialize existing queries,
12
17
  // relying on useMemo here is only a performance optimization.
13
18
  // hydrate can and should be run *during* render here for SSR to work properly
14
-
15
19
  React.useMemo(() => {
16
20
  if (state) {
17
- hydrate(queryClient, state, optionsRef.current);
21
+ hydrate(client, state, optionsRef.current);
18
22
  }
19
- }, [queryClient, state]);
20
- }
21
- const Hydrate = ({
22
- children,
23
- options,
24
- state
25
- }) => {
26
- useHydrate(state, options);
23
+ }, [client, state]);
27
24
  return children;
28
25
  };
29
26
 
30
- export { Hydrate, useHydrate };
31
- //# sourceMappingURL=Hydrate.esm.js.map
27
+ export { HydrationBoundary };
28
+ //# sourceMappingURL=HydrationBoundary.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HydrationBoundary.esm.js","sources":["../../src/HydrationBoundary.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport type { HydrateOptions, QueryClient } from '@tanstack/query-core'\nimport { hydrate } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\n\nexport interface HydrationBoundaryProps {\n state?: unknown\n options?: HydrateOptions\n children?: React.ReactNode\n queryClient?: QueryClient\n}\n\nexport const HydrationBoundary = ({\n children,\n options = {},\n state,\n queryClient,\n}: HydrationBoundaryProps) => {\n const client = useQueryClient(queryClient)\n\n const optionsRef = React.useRef(options)\n optionsRef.current = options\n\n // Running hydrate again with the same queries is safe,\n // it wont overwrite or initialize existing queries,\n // relying on useMemo here is only a performance optimization.\n // hydrate can and should be run *during* render here for SSR to work properly\n React.useMemo(() => {\n if (state) {\n hydrate(client, state, optionsRef.current)\n }\n }, [client, state])\n\n return children as React.ReactElement\n}\n"],"names":["HydrationBoundary","children","options","state","queryClient","client","useQueryClient","optionsRef","React","useRef","current","useMemo","hydrate"],"mappings":";;;;AAcO,MAAMA,iBAAiB,GAAG,CAAC;EAChCC,QAAQ;EACRC,OAAO,GAAG,EAAE;EACZC,KAAK;AACLC,EAAAA,WAAAA;AACsB,CAAC,KAAK;AAC5B,EAAA,MAAMC,MAAM,GAAGC,cAAc,CAACF,WAAW,CAAC,CAAA;AAE1C,EAAA,MAAMG,UAAU,GAAGC,KAAK,CAACC,MAAM,CAACP,OAAO,CAAC,CAAA;EACxCK,UAAU,CAACG,OAAO,GAAGR,OAAO,CAAA;;AAE5B;AACA;AACA;AACA;EACAM,KAAK,CAACG,OAAO,CAAC,MAAM;AAClB,IAAA,IAAIR,KAAK,EAAE;MACTS,OAAO,CAACP,MAAM,EAAEF,KAAK,EAAEI,UAAU,CAACG,OAAO,CAAC,CAAA;AAC5C,KAAA;AACF,GAAC,EAAE,CAACL,MAAM,EAAEF,KAAK,CAAC,CAAC,CAAA;AAEnB,EAAA,OAAOF,QAAQ,CAAA;AACjB;;;;"}
@@ -1,13 +1,10 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var React = require('react');
6
4
  var queryCore = require('@tanstack/query-core');
7
5
  var QueryClientProvider = require('./QueryClientProvider.js');
8
6
 
9
- function _interopNamespace(e) {
10
- if (e && e.__esModule) return e;
7
+ function _interopNamespaceDefault(e) {
11
8
  var n = Object.create(null);
12
9
  if (e) {
13
10
  Object.keys(e).forEach(function (k) {
@@ -20,37 +17,33 @@ function _interopNamespace(e) {
20
17
  }
21
18
  });
22
19
  }
23
- n["default"] = e;
20
+ n.default = e;
24
21
  return Object.freeze(n);
25
22
  }
26
23
 
27
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
24
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
28
25
 
29
- function useHydrate(state, options = {}) {
30
- const queryClient = QueryClientProvider.useQueryClient({
31
- context: options.context
32
- });
26
+ const HydrationBoundary = ({
27
+ children,
28
+ options = {},
29
+ state,
30
+ queryClient
31
+ }) => {
32
+ const client = QueryClientProvider.useQueryClient(queryClient);
33
33
  const optionsRef = React__namespace.useRef(options);
34
- optionsRef.current = options; // Running hydrate again with the same queries is safe,
34
+ optionsRef.current = options;
35
+
36
+ // Running hydrate again with the same queries is safe,
35
37
  // it wont overwrite or initialize existing queries,
36
38
  // relying on useMemo here is only a performance optimization.
37
39
  // hydrate can and should be run *during* render here for SSR to work properly
38
-
39
40
  React__namespace.useMemo(() => {
40
41
  if (state) {
41
- queryCore.hydrate(queryClient, state, optionsRef.current);
42
+ queryCore.hydrate(client, state, optionsRef.current);
42
43
  }
43
- }, [queryClient, state]);
44
- }
45
- const Hydrate = ({
46
- children,
47
- options,
48
- state
49
- }) => {
50
- useHydrate(state, options);
44
+ }, [client, state]);
51
45
  return children;
52
46
  };
53
47
 
54
- exports.Hydrate = Hydrate;
55
- exports.useHydrate = useHydrate;
56
- //# sourceMappingURL=Hydrate.js.map
48
+ exports.HydrationBoundary = HydrationBoundary;
49
+ //# sourceMappingURL=HydrationBoundary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HydrationBoundary.js","sources":["../../src/HydrationBoundary.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport type { HydrateOptions, QueryClient } from '@tanstack/query-core'\nimport { hydrate } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\n\nexport interface HydrationBoundaryProps {\n state?: unknown\n options?: HydrateOptions\n children?: React.ReactNode\n queryClient?: QueryClient\n}\n\nexport const HydrationBoundary = ({\n children,\n options = {},\n state,\n queryClient,\n}: HydrationBoundaryProps) => {\n const client = useQueryClient(queryClient)\n\n const optionsRef = React.useRef(options)\n optionsRef.current = options\n\n // Running hydrate again with the same queries is safe,\n // it wont overwrite or initialize existing queries,\n // relying on useMemo here is only a performance optimization.\n // hydrate can and should be run *during* render here for SSR to work properly\n React.useMemo(() => {\n if (state) {\n hydrate(client, state, optionsRef.current)\n }\n }, [client, state])\n\n return children as React.ReactElement\n}\n"],"names":["HydrationBoundary","children","options","state","queryClient","client","useQueryClient","optionsRef","React","useRef","current","useMemo","hydrate"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAcO,MAAMA,iBAAiB,GAAG,CAAC;EAChCC,QAAQ;EACRC,OAAO,GAAG,EAAE;EACZC,KAAK;AACLC,EAAAA,WAAAA;AACsB,CAAC,KAAK;AAC5B,EAAA,MAAMC,MAAM,GAAGC,kCAAc,CAACF,WAAW,CAAC,CAAA;AAE1C,EAAA,MAAMG,UAAU,GAAGC,gBAAK,CAACC,MAAM,CAACP,OAAO,CAAC,CAAA;EACxCK,UAAU,CAACG,OAAO,GAAGR,OAAO,CAAA;;AAE5B;AACA;AACA;AACA;EACAM,gBAAK,CAACG,OAAO,CAAC,MAAM;AAClB,IAAA,IAAIR,KAAK,EAAE;MACTS,iBAAO,CAACP,MAAM,EAAEF,KAAK,EAAEI,UAAU,CAACG,OAAO,CAAC,CAAA;AAC5C,KAAA;AACF,GAAC,EAAE,CAACL,MAAM,EAAEF,KAAK,CAAC,CAAC,CAAA;AAEnB,EAAA,OAAOF,QAAQ,CAAA;AACjB;;;;"}
@@ -2,30 +2,27 @@ import * as React from 'react';
2
2
  import { hydrate } from '@tanstack/query-core';
3
3
  import { useQueryClient } from './QueryClientProvider.mjs';
4
4
 
5
- function useHydrate(state, options = {}) {
6
- const queryClient = useQueryClient({
7
- context: options.context
8
- });
5
+ const HydrationBoundary = ({
6
+ children,
7
+ options = {},
8
+ state,
9
+ queryClient
10
+ }) => {
11
+ const client = useQueryClient(queryClient);
9
12
  const optionsRef = React.useRef(options);
10
- optionsRef.current = options; // Running hydrate again with the same queries is safe,
13
+ optionsRef.current = options;
14
+
15
+ // Running hydrate again with the same queries is safe,
11
16
  // it wont overwrite or initialize existing queries,
12
17
  // relying on useMemo here is only a performance optimization.
13
18
  // hydrate can and should be run *during* render here for SSR to work properly
14
-
15
19
  React.useMemo(() => {
16
20
  if (state) {
17
- hydrate(queryClient, state, optionsRef.current);
21
+ hydrate(client, state, optionsRef.current);
18
22
  }
19
- }, [queryClient, state]);
20
- }
21
- const Hydrate = ({
22
- children,
23
- options,
24
- state
25
- }) => {
26
- useHydrate(state, options);
23
+ }, [client, state]);
27
24
  return children;
28
25
  };
29
26
 
30
- export { Hydrate, useHydrate };
31
- //# sourceMappingURL=Hydrate.mjs.map
27
+ export { HydrationBoundary };
28
+ //# sourceMappingURL=HydrationBoundary.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HydrationBoundary.mjs","sources":["../../src/HydrationBoundary.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport type { HydrateOptions, QueryClient } from '@tanstack/query-core'\nimport { hydrate } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\n\nexport interface HydrationBoundaryProps {\n state?: unknown\n options?: HydrateOptions\n children?: React.ReactNode\n queryClient?: QueryClient\n}\n\nexport const HydrationBoundary = ({\n children,\n options = {},\n state,\n queryClient,\n}: HydrationBoundaryProps) => {\n const client = useQueryClient(queryClient)\n\n const optionsRef = React.useRef(options)\n optionsRef.current = options\n\n // Running hydrate again with the same queries is safe,\n // it wont overwrite or initialize existing queries,\n // relying on useMemo here is only a performance optimization.\n // hydrate can and should be run *during* render here for SSR to work properly\n React.useMemo(() => {\n if (state) {\n hydrate(client, state, optionsRef.current)\n }\n }, [client, state])\n\n return children as React.ReactElement\n}\n"],"names":["HydrationBoundary","children","options","state","queryClient","client","useQueryClient","optionsRef","React","useRef","current","useMemo","hydrate"],"mappings":";;;;AAcO,MAAMA,iBAAiB,GAAG,CAAC;EAChCC,QAAQ;EACRC,OAAO,GAAG,EAAE;EACZC,KAAK;AACLC,EAAAA,WAAAA;AACsB,CAAC,KAAK;AAC5B,EAAA,MAAMC,MAAM,GAAGC,cAAc,CAACF,WAAW,CAAC,CAAA;AAE1C,EAAA,MAAMG,UAAU,GAAGC,KAAK,CAACC,MAAM,CAACP,OAAO,CAAC,CAAA;EACxCK,UAAU,CAACG,OAAO,GAAGR,OAAO,CAAA;;AAE5B;AACA;AACA;AACA;EACAM,KAAK,CAACG,OAAO,CAAC,MAAM;AAClB,IAAA,IAAIR,KAAK,EAAE;MACTS,OAAO,CAACP,MAAM,EAAEF,KAAK,EAAEI,UAAU,CAACG,OAAO,CAAC,CAAA;AAC5C,KAAA;AACF,GAAC,EAAE,CAACL,MAAM,EAAEF,KAAK,CAAC,CAAC,CAAA;AAEnB,EAAA,OAAOF,QAAQ,CAAA;AACjB;;;;"}
@@ -1,24 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import type { QueryClient } from '@tanstack/query-core';
3
- import type { ContextOptions } from './types';
4
- declare global {
5
- interface Window {
6
- ReactQueryClientContext?: React.Context<QueryClient | undefined>;
7
- }
8
- }
9
- export declare const defaultContext: React.Context<QueryClient | undefined>;
10
- export declare const useQueryClient: ({ context }?: ContextOptions) => QueryClient;
11
- declare type QueryClientProviderPropsBase = {
3
+ export declare const QueryClientContext: React.Context<QueryClient | undefined>;
4
+ export declare const useQueryClient: (queryClient?: QueryClient) => QueryClient;
5
+ export declare type QueryClientProviderProps = {
12
6
  client: QueryClient;
13
7
  children?: React.ReactNode;
14
8
  };
15
- declare type QueryClientProviderPropsWithContext = ContextOptions & {
16
- contextSharing?: never;
17
- } & QueryClientProviderPropsBase;
18
- declare type QueryClientProviderPropsWithContextSharing = {
19
- context?: never;
20
- contextSharing?: boolean;
21
- } & QueryClientProviderPropsBase;
22
- export declare type QueryClientProviderProps = QueryClientProviderPropsWithContext | QueryClientProviderPropsWithContextSharing;
23
- export declare const QueryClientProvider: ({ client, children, context, contextSharing, }: QueryClientProviderProps) => JSX.Element;
24
- export {};
9
+ export declare const QueryClientProvider: ({ client, children, }: QueryClientProviderProps) => JSX.Element;
@@ -1,46 +1,19 @@
1
1
  import * as React from 'react';
2
2
 
3
- const defaultContext = /*#__PURE__*/React.createContext(undefined);
4
- const QueryClientSharingContext = /*#__PURE__*/React.createContext(false); // If we are given a context, we will use it.
5
- // Otherwise, if contextSharing is on, we share the first and at least one
6
- // instance of the context across the window
7
- // to ensure that if React Query is used across
8
- // different bundles or microfrontends they will
9
- // all use the same **instance** of context, regardless
10
- // of module scoping.
11
-
12
- function getQueryClientContext(context, contextSharing) {
13
- if (context) {
14
- return context;
15
- }
16
-
17
- if (contextSharing && typeof window !== 'undefined') {
18
- if (!window.ReactQueryClientContext) {
19
- window.ReactQueryClientContext = defaultContext;
20
- }
21
-
22
- return window.ReactQueryClientContext;
3
+ const QueryClientContext = /*#__PURE__*/React.createContext(undefined);
4
+ const useQueryClient = queryClient => {
5
+ const client = React.useContext(QueryClientContext);
6
+ if (queryClient) {
7
+ return queryClient;
23
8
  }
24
-
25
- return defaultContext;
26
- }
27
-
28
- const useQueryClient = ({
29
- context
30
- } = {}) => {
31
- const queryClient = React.useContext(getQueryClientContext(context, React.useContext(QueryClientSharingContext)));
32
-
33
- if (!queryClient) {
9
+ if (!client) {
34
10
  throw new Error('No QueryClient set, use QueryClientProvider to set one');
35
11
  }
36
-
37
- return queryClient;
12
+ return client;
38
13
  };
39
14
  const QueryClientProvider = ({
40
15
  client,
41
- children,
42
- context,
43
- contextSharing = false
16
+ children
44
17
  }) => {
45
18
  React.useEffect(() => {
46
19
  client.mount();
@@ -48,18 +21,10 @@ const QueryClientProvider = ({
48
21
  client.unmount();
49
22
  };
50
23
  }, [client]);
51
-
52
- if (process.env.NODE_ENV !== 'production' && contextSharing) {
53
- client.getLogger().error("The contextSharing option has been deprecated and will be removed in the next major version");
54
- }
55
-
56
- const Context = getQueryClientContext(context, contextSharing);
57
- return /*#__PURE__*/React.createElement(QueryClientSharingContext.Provider, {
58
- value: !context && contextSharing
59
- }, /*#__PURE__*/React.createElement(Context.Provider, {
24
+ return /*#__PURE__*/React.createElement(QueryClientContext.Provider, {
60
25
  value: client
61
- }, children));
26
+ }, children);
62
27
  };
63
28
 
64
- export { QueryClientProvider, defaultContext, useQueryClient };
29
+ export { QueryClientContext, QueryClientProvider, useQueryClient };
65
30
  //# sourceMappingURL=QueryClientProvider.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"QueryClientProvider.esm.js","sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport type { QueryClient } from '@tanstack/query-core'\nimport type { ContextOptions } from './types'\n\ndeclare global {\n interface Window {\n ReactQueryClientContext?: React.Context<QueryClient | undefined>\n }\n}\n\nexport const defaultContext = React.createContext<QueryClient | undefined>(\n undefined,\n)\nconst QueryClientSharingContext = React.createContext<boolean>(false)\n\n// If we are given a context, we will use it.\n// Otherwise, if contextSharing is on, we share the first and at least one\n// instance of the context across the window\n// to ensure that if React Query is used across\n// different bundles or microfrontends they will\n// all use the same **instance** of context, regardless\n// of module scoping.\nfunction getQueryClientContext(\n context: React.Context<QueryClient | undefined> | undefined,\n contextSharing: boolean,\n) {\n if (context) {\n return context\n }\n if (contextSharing && typeof window !== 'undefined') {\n if (!window.ReactQueryClientContext) {\n window.ReactQueryClientContext = defaultContext\n }\n\n return window.ReactQueryClientContext\n }\n\n return defaultContext\n}\n\nexport const useQueryClient = ({ context }: ContextOptions = {}) => {\n const queryClient = React.useContext(\n getQueryClientContext(context, React.useContext(QueryClientSharingContext)),\n )\n\n if (!queryClient) {\n throw new Error('No QueryClient set, use QueryClientProvider to set one')\n }\n\n return queryClient\n}\n\ntype QueryClientProviderPropsBase = {\n client: QueryClient\n children?: React.ReactNode\n}\ntype QueryClientProviderPropsWithContext = ContextOptions & {\n contextSharing?: never\n} & QueryClientProviderPropsBase\ntype QueryClientProviderPropsWithContextSharing = {\n context?: never\n contextSharing?: boolean\n} & QueryClientProviderPropsBase\n\nexport type QueryClientProviderProps =\n | QueryClientProviderPropsWithContext\n | QueryClientProviderPropsWithContextSharing\n\nexport const QueryClientProvider = ({\n client,\n children,\n context,\n contextSharing = false,\n}: QueryClientProviderProps): JSX.Element => {\n React.useEffect(() => {\n client.mount()\n return () => {\n client.unmount()\n }\n }, [client])\n\n if (process.env.NODE_ENV !== 'production' && contextSharing) {\n client\n .getLogger()\n .error(\n `The contextSharing option has been deprecated and will be removed in the next major version`,\n )\n }\n\n const Context = getQueryClientContext(context, contextSharing)\n\n return (\n <QueryClientSharingContext.Provider value={!context && contextSharing}>\n <Context.Provider value={client}>{children}</Context.Provider>\n </QueryClientSharingContext.Provider>\n )\n}\n"],"names":["defaultContext","React","createContext","undefined","QueryClientSharingContext","getQueryClientContext","context","contextSharing","window","ReactQueryClientContext","useQueryClient","queryClient","useContext","Error","QueryClientProvider","client","children","useEffect","mount","unmount","process","env","NODE_ENV","getLogger","error","Context"],"mappings":";;AAYO,MAAMA,cAAc,gBAAGC,KAAK,CAACC,aAAN,CAC5BC,SAD4B,EAAvB;AAGP,MAAMC,yBAAyB,gBAAGH,KAAK,CAACC,aAAN,CAA6B,KAA7B,CAAlC;AAGA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASG,qBAAT,CACEC,OADF,EAEEC,cAFF,EAGE;AACA,EAAA,IAAID,OAAJ,EAAa;AACX,IAAA,OAAOA,OAAP,CAAA;AACD,GAAA;;AACD,EAAA,IAAIC,cAAc,IAAI,OAAOC,MAAP,KAAkB,WAAxC,EAAqD;AACnD,IAAA,IAAI,CAACA,MAAM,CAACC,uBAAZ,EAAqC;MACnCD,MAAM,CAACC,uBAAP,GAAiCT,cAAjC,CAAA;AACD,KAAA;;IAED,OAAOQ,MAAM,CAACC,uBAAd,CAAA;AACD,GAAA;;AAED,EAAA,OAAOT,cAAP,CAAA;AACD,CAAA;;AAEM,MAAMU,cAAc,GAAG,CAAC;AAAEJ,EAAAA,OAAAA;AAAF,CAAA,GAA8B,EAA/B,KAAsC;AAClE,EAAA,MAAMK,WAAW,GAAGV,KAAK,CAACW,UAAN,CAClBP,qBAAqB,CAACC,OAAD,EAAUL,KAAK,CAACW,UAAN,CAAiBR,yBAAjB,CAAV,CADH,CAApB,CAAA;;EAIA,IAAI,CAACO,WAAL,EAAkB;AAChB,IAAA,MAAM,IAAIE,KAAJ,CAAU,wDAAV,CAAN,CAAA;AACD,GAAA;;AAED,EAAA,OAAOF,WAAP,CAAA;AACD,EAVM;AA4BA,MAAMG,mBAAmB,GAAG,CAAC;EAClCC,MADkC;EAElCC,QAFkC;EAGlCV,OAHkC;AAIlCC,EAAAA,cAAc,GAAG,KAAA;AAJiB,CAAD,KAKU;EAC3CN,KAAK,CAACgB,SAAN,CAAgB,MAAM;AACpBF,IAAAA,MAAM,CAACG,KAAP,EAAA,CAAA;AACA,IAAA,OAAO,MAAM;AACXH,MAAAA,MAAM,CAACI,OAAP,EAAA,CAAA;KADF,CAAA;GAFF,EAKG,CAACJ,MAAD,CALH,CAAA,CAAA;;EAOA,IAAIK,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAAzB,IAAyCf,cAA7C,EAA6D;IAC3DQ,MAAM,CACHQ,SADH,EAAA,CAEGC,KAFH,CAAA,6FAAA,CAAA,CAAA;AAKD,GAAA;;AAED,EAAA,MAAMC,OAAO,GAAGpB,qBAAqB,CAACC,OAAD,EAAUC,cAAV,CAArC,CAAA;EAEA,oBACE,KAAA,CAAA,aAAA,CAAC,yBAAD,CAA2B,QAA3B,EAAA;IAAoC,KAAK,EAAE,CAACD,OAAD,IAAYC,cAAAA;GACrD,eAAA,KAAA,CAAA,aAAA,CAAC,OAAD,CAAS,QAAT,EAAA;AAAkB,IAAA,KAAK,EAAEQ,MAAAA;GAASC,EAAAA,QAAlC,CADF,CADF,CAAA;AAKD;;;;"}
1
+ {"version":3,"file":"QueryClientProvider.esm.js","sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport type { QueryClient } from '@tanstack/query-core'\n\nexport const QueryClientContext = React.createContext<QueryClient | undefined>(\n undefined,\n)\n\nexport const useQueryClient = (queryClient?: QueryClient) => {\n const client = React.useContext(QueryClientContext)\n\n if (queryClient) {\n return queryClient\n }\n\n if (!client) {\n throw new Error('No QueryClient set, use QueryClientProvider to set one')\n }\n\n return client\n}\n\nexport type QueryClientProviderProps = {\n client: QueryClient\n children?: React.ReactNode\n}\n\nexport const QueryClientProvider = ({\n client,\n children,\n}: QueryClientProviderProps): JSX.Element => {\n React.useEffect(() => {\n client.mount()\n return () => {\n client.unmount()\n }\n }, [client])\n\n return (\n <QueryClientContext.Provider value={client}>\n {children}\n </QueryClientContext.Provider>\n )\n}\n"],"names":["QueryClientContext","React","createContext","undefined","useQueryClient","queryClient","client","useContext","Error","QueryClientProvider","children","useEffect","mount","unmount"],"mappings":";;AAKO,MAAMA,kBAAkB,gBAAGC,KAAK,CAACC,aAAa,CACnDC,SAAS,EACV;AAEYC,MAAAA,cAAc,GAAIC,WAAyB,IAAK;AAC3D,EAAA,MAAMC,MAAM,GAAGL,KAAK,CAACM,UAAU,CAACP,kBAAkB,CAAC,CAAA;AAEnD,EAAA,IAAIK,WAAW,EAAE;AACf,IAAA,OAAOA,WAAW,CAAA;AACpB,GAAA;EAEA,IAAI,CAACC,MAAM,EAAE;AACX,IAAA,MAAM,IAAIE,KAAK,CAAC,wDAAwD,CAAC,CAAA;AAC3E,GAAA;AAEA,EAAA,OAAOF,MAAM,CAAA;AACf,EAAC;AAOM,MAAMG,mBAAmB,GAAG,CAAC;EAClCH,MAAM;AACNI,EAAAA,QAAAA;AACwB,CAAC,KAAkB;EAC3CT,KAAK,CAACU,SAAS,CAAC,MAAM;IACpBL,MAAM,CAACM,KAAK,EAAE,CAAA;AACd,IAAA,OAAO,MAAM;MACXN,MAAM,CAACO,OAAO,EAAE,CAAA;KACjB,CAAA;AACH,GAAC,EAAE,CAACP,MAAM,CAAC,CAAC,CAAA;EAEZ,oBACE,KAAA,CAAA,aAAA,CAAC,kBAAkB,CAAC,QAAQ,EAAA;AAAC,IAAA,KAAK,EAAEA,MAAAA;AAAO,GAAA,EACxCI,QAAQ,CACmB,CAAA;AAElC;;;;"}
@@ -1,11 +1,8 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var React = require('react');
6
4
 
7
- function _interopNamespace(e) {
8
- if (e && e.__esModule) return e;
5
+ function _interopNamespaceDefault(e) {
9
6
  var n = Object.create(null);
10
7
  if (e) {
11
8
  Object.keys(e).forEach(function (k) {
@@ -18,53 +15,26 @@ function _interopNamespace(e) {
18
15
  }
19
16
  });
20
17
  }
21
- n["default"] = e;
18
+ n.default = e;
22
19
  return Object.freeze(n);
23
20
  }
24
21
 
25
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
26
-
27
- const defaultContext = /*#__PURE__*/React__namespace.createContext(undefined);
28
- const QueryClientSharingContext = /*#__PURE__*/React__namespace.createContext(false); // If we are given a context, we will use it.
29
- // Otherwise, if contextSharing is on, we share the first and at least one
30
- // instance of the context across the window
31
- // to ensure that if React Query is used across
32
- // different bundles or microfrontends they will
33
- // all use the same **instance** of context, regardless
34
- // of module scoping.
22
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
35
23
 
36
- function getQueryClientContext(context, contextSharing) {
37
- if (context) {
38
- return context;
24
+ const QueryClientContext = /*#__PURE__*/React__namespace.createContext(undefined);
25
+ const useQueryClient = queryClient => {
26
+ const client = React__namespace.useContext(QueryClientContext);
27
+ if (queryClient) {
28
+ return queryClient;
39
29
  }
40
-
41
- if (contextSharing && typeof window !== 'undefined') {
42
- if (!window.ReactQueryClientContext) {
43
- window.ReactQueryClientContext = defaultContext;
44
- }
45
-
46
- return window.ReactQueryClientContext;
47
- }
48
-
49
- return defaultContext;
50
- }
51
-
52
- const useQueryClient = ({
53
- context
54
- } = {}) => {
55
- const queryClient = React__namespace.useContext(getQueryClientContext(context, React__namespace.useContext(QueryClientSharingContext)));
56
-
57
- if (!queryClient) {
30
+ if (!client) {
58
31
  throw new Error('No QueryClient set, use QueryClientProvider to set one');
59
32
  }
60
-
61
- return queryClient;
33
+ return client;
62
34
  };
63
35
  const QueryClientProvider = ({
64
36
  client,
65
- children,
66
- context,
67
- contextSharing = false
37
+ children
68
38
  }) => {
69
39
  React__namespace.useEffect(() => {
70
40
  client.mount();
@@ -72,20 +42,12 @@ const QueryClientProvider = ({
72
42
  client.unmount();
73
43
  };
74
44
  }, [client]);
75
-
76
- if (process.env.NODE_ENV !== 'production' && contextSharing) {
77
- client.getLogger().error("The contextSharing option has been deprecated and will be removed in the next major version");
78
- }
79
-
80
- const Context = getQueryClientContext(context, contextSharing);
81
- return /*#__PURE__*/React__namespace.createElement(QueryClientSharingContext.Provider, {
82
- value: !context && contextSharing
83
- }, /*#__PURE__*/React__namespace.createElement(Context.Provider, {
45
+ return /*#__PURE__*/React__namespace.createElement(QueryClientContext.Provider, {
84
46
  value: client
85
- }, children));
47
+ }, children);
86
48
  };
87
49
 
50
+ exports.QueryClientContext = QueryClientContext;
88
51
  exports.QueryClientProvider = QueryClientProvider;
89
- exports.defaultContext = defaultContext;
90
52
  exports.useQueryClient = useQueryClient;
91
53
  //# sourceMappingURL=QueryClientProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"QueryClientProvider.js","sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport type { QueryClient } from '@tanstack/query-core'\nimport type { ContextOptions } from './types'\n\ndeclare global {\n interface Window {\n ReactQueryClientContext?: React.Context<QueryClient | undefined>\n }\n}\n\nexport const defaultContext = React.createContext<QueryClient | undefined>(\n undefined,\n)\nconst QueryClientSharingContext = React.createContext<boolean>(false)\n\n// If we are given a context, we will use it.\n// Otherwise, if contextSharing is on, we share the first and at least one\n// instance of the context across the window\n// to ensure that if React Query is used across\n// different bundles or microfrontends they will\n// all use the same **instance** of context, regardless\n// of module scoping.\nfunction getQueryClientContext(\n context: React.Context<QueryClient | undefined> | undefined,\n contextSharing: boolean,\n) {\n if (context) {\n return context\n }\n if (contextSharing && typeof window !== 'undefined') {\n if (!window.ReactQueryClientContext) {\n window.ReactQueryClientContext = defaultContext\n }\n\n return window.ReactQueryClientContext\n }\n\n return defaultContext\n}\n\nexport const useQueryClient = ({ context }: ContextOptions = {}) => {\n const queryClient = React.useContext(\n getQueryClientContext(context, React.useContext(QueryClientSharingContext)),\n )\n\n if (!queryClient) {\n throw new Error('No QueryClient set, use QueryClientProvider to set one')\n }\n\n return queryClient\n}\n\ntype QueryClientProviderPropsBase = {\n client: QueryClient\n children?: React.ReactNode\n}\ntype QueryClientProviderPropsWithContext = ContextOptions & {\n contextSharing?: never\n} & QueryClientProviderPropsBase\ntype QueryClientProviderPropsWithContextSharing = {\n context?: never\n contextSharing?: boolean\n} & QueryClientProviderPropsBase\n\nexport type QueryClientProviderProps =\n | QueryClientProviderPropsWithContext\n | QueryClientProviderPropsWithContextSharing\n\nexport const QueryClientProvider = ({\n client,\n children,\n context,\n contextSharing = false,\n}: QueryClientProviderProps): JSX.Element => {\n React.useEffect(() => {\n client.mount()\n return () => {\n client.unmount()\n }\n }, [client])\n\n if (process.env.NODE_ENV !== 'production' && contextSharing) {\n client\n .getLogger()\n .error(\n `The contextSharing option has been deprecated and will be removed in the next major version`,\n )\n }\n\n const Context = getQueryClientContext(context, contextSharing)\n\n return (\n <QueryClientSharingContext.Provider value={!context && contextSharing}>\n <Context.Provider value={client}>{children}</Context.Provider>\n </QueryClientSharingContext.Provider>\n )\n}\n"],"names":["defaultContext","React","createContext","undefined","QueryClientSharingContext","getQueryClientContext","context","contextSharing","window","ReactQueryClientContext","useQueryClient","queryClient","useContext","Error","QueryClientProvider","client","children","useEffect","mount","unmount","process","env","NODE_ENV","getLogger","error","Context"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAYO,MAAMA,cAAc,gBAAGC,gBAAK,CAACC,aAAN,CAC5BC,SAD4B,EAAvB;AAGP,MAAMC,yBAAyB,gBAAGH,gBAAK,CAACC,aAAN,CAA6B,KAA7B,CAAlC;AAGA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASG,qBAAT,CACEC,OADF,EAEEC,cAFF,EAGE;AACA,EAAA,IAAID,OAAJ,EAAa;AACX,IAAA,OAAOA,OAAP,CAAA;AACD,GAAA;;AACD,EAAA,IAAIC,cAAc,IAAI,OAAOC,MAAP,KAAkB,WAAxC,EAAqD;AACnD,IAAA,IAAI,CAACA,MAAM,CAACC,uBAAZ,EAAqC;MACnCD,MAAM,CAACC,uBAAP,GAAiCT,cAAjC,CAAA;AACD,KAAA;;IAED,OAAOQ,MAAM,CAACC,uBAAd,CAAA;AACD,GAAA;;AAED,EAAA,OAAOT,cAAP,CAAA;AACD,CAAA;;AAEM,MAAMU,cAAc,GAAG,CAAC;AAAEJ,EAAAA,OAAAA;AAAF,CAAA,GAA8B,EAA/B,KAAsC;AAClE,EAAA,MAAMK,WAAW,GAAGV,gBAAK,CAACW,UAAN,CAClBP,qBAAqB,CAACC,OAAD,EAAUL,gBAAK,CAACW,UAAN,CAAiBR,yBAAjB,CAAV,CADH,CAApB,CAAA;;EAIA,IAAI,CAACO,WAAL,EAAkB;AAChB,IAAA,MAAM,IAAIE,KAAJ,CAAU,wDAAV,CAAN,CAAA;AACD,GAAA;;AAED,EAAA,OAAOF,WAAP,CAAA;AACD,EAVM;AA4BA,MAAMG,mBAAmB,GAAG,CAAC;EAClCC,MADkC;EAElCC,QAFkC;EAGlCV,OAHkC;AAIlCC,EAAAA,cAAc,GAAG,KAAA;AAJiB,CAAD,KAKU;EAC3CN,gBAAK,CAACgB,SAAN,CAAgB,MAAM;AACpBF,IAAAA,MAAM,CAACG,KAAP,EAAA,CAAA;AACA,IAAA,OAAO,MAAM;AACXH,MAAAA,MAAM,CAACI,OAAP,EAAA,CAAA;KADF,CAAA;GAFF,EAKG,CAACJ,MAAD,CALH,CAAA,CAAA;;EAOA,IAAIK,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAAzB,IAAyCf,cAA7C,EAA6D;IAC3DQ,MAAM,CACHQ,SADH,EAAA,CAEGC,KAFH,CAAA,6FAAA,CAAA,CAAA;AAKD,GAAA;;AAED,EAAA,MAAMC,OAAO,GAAGpB,qBAAqB,CAACC,OAAD,EAAUC,cAAV,CAArC,CAAA;EAEA,oBACEN,gBAAA,CAAA,aAAA,CAAC,yBAAD,CAA2B,QAA3B,EAAA;IAAoC,KAAK,EAAE,CAACK,OAAD,IAAYC,cAAAA;GACrD,eAAAN,gBAAA,CAAA,aAAA,CAAC,OAAD,CAAS,QAAT,EAAA;AAAkB,IAAA,KAAK,EAAEc,MAAAA;GAASC,EAAAA,QAAlC,CADF,CADF,CAAA;AAKD;;;;;;"}
1
+ {"version":3,"file":"QueryClientProvider.js","sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport type { QueryClient } from '@tanstack/query-core'\n\nexport const QueryClientContext = React.createContext<QueryClient | undefined>(\n undefined,\n)\n\nexport const useQueryClient = (queryClient?: QueryClient) => {\n const client = React.useContext(QueryClientContext)\n\n if (queryClient) {\n return queryClient\n }\n\n if (!client) {\n throw new Error('No QueryClient set, use QueryClientProvider to set one')\n }\n\n return client\n}\n\nexport type QueryClientProviderProps = {\n client: QueryClient\n children?: React.ReactNode\n}\n\nexport const QueryClientProvider = ({\n client,\n children,\n}: QueryClientProviderProps): JSX.Element => {\n React.useEffect(() => {\n client.mount()\n return () => {\n client.unmount()\n }\n }, [client])\n\n return (\n <QueryClientContext.Provider value={client}>\n {children}\n </QueryClientContext.Provider>\n )\n}\n"],"names":["QueryClientContext","React","createContext","undefined","useQueryClient","queryClient","client","useContext","Error","QueryClientProvider","children","useEffect","mount","unmount"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAKO,MAAMA,kBAAkB,gBAAGC,gBAAK,CAACC,aAAa,CACnDC,SAAS,EACV;AAEYC,MAAAA,cAAc,GAAIC,WAAyB,IAAK;AAC3D,EAAA,MAAMC,MAAM,GAAGL,gBAAK,CAACM,UAAU,CAACP,kBAAkB,CAAC,CAAA;AAEnD,EAAA,IAAIK,WAAW,EAAE;AACf,IAAA,OAAOA,WAAW,CAAA;AACpB,GAAA;EAEA,IAAI,CAACC,MAAM,EAAE;AACX,IAAA,MAAM,IAAIE,KAAK,CAAC,wDAAwD,CAAC,CAAA;AAC3E,GAAA;AAEA,EAAA,OAAOF,MAAM,CAAA;AACf,EAAC;AAOM,MAAMG,mBAAmB,GAAG,CAAC;EAClCH,MAAM;AACNI,EAAAA,QAAAA;AACwB,CAAC,KAAkB;EAC3CT,gBAAK,CAACU,SAAS,CAAC,MAAM;IACpBL,MAAM,CAACM,KAAK,EAAE,CAAA;AACd,IAAA,OAAO,MAAM;MACXN,MAAM,CAACO,OAAO,EAAE,CAAA;KACjB,CAAA;AACH,GAAC,EAAE,CAACP,MAAM,CAAC,CAAC,CAAA;EAEZ,oBACEL,gBAAA,CAAA,aAAA,CAAC,kBAAkB,CAAC,QAAQ,EAAA;AAAC,IAAA,KAAK,EAAEK,MAAAA;AAAO,GAAA,EACxCI,QAAQ,CACmB,CAAA;AAElC;;;;;;"}
@@ -1,46 +1,19 @@
1
1
  import * as React from 'react';
2
2
 
3
- const defaultContext = /*#__PURE__*/React.createContext(undefined);
4
- const QueryClientSharingContext = /*#__PURE__*/React.createContext(false); // If we are given a context, we will use it.
5
- // Otherwise, if contextSharing is on, we share the first and at least one
6
- // instance of the context across the window
7
- // to ensure that if React Query is used across
8
- // different bundles or microfrontends they will
9
- // all use the same **instance** of context, regardless
10
- // of module scoping.
11
-
12
- function getQueryClientContext(context, contextSharing) {
13
- if (context) {
14
- return context;
15
- }
16
-
17
- if (contextSharing && typeof window !== 'undefined') {
18
- if (!window.ReactQueryClientContext) {
19
- window.ReactQueryClientContext = defaultContext;
20
- }
21
-
22
- return window.ReactQueryClientContext;
3
+ const QueryClientContext = /*#__PURE__*/React.createContext(undefined);
4
+ const useQueryClient = queryClient => {
5
+ const client = React.useContext(QueryClientContext);
6
+ if (queryClient) {
7
+ return queryClient;
23
8
  }
24
-
25
- return defaultContext;
26
- }
27
-
28
- const useQueryClient = ({
29
- context
30
- } = {}) => {
31
- const queryClient = React.useContext(getQueryClientContext(context, React.useContext(QueryClientSharingContext)));
32
-
33
- if (!queryClient) {
9
+ if (!client) {
34
10
  throw new Error('No QueryClient set, use QueryClientProvider to set one');
35
11
  }
36
-
37
- return queryClient;
12
+ return client;
38
13
  };
39
14
  const QueryClientProvider = ({
40
15
  client,
41
- children,
42
- context,
43
- contextSharing = false
16
+ children
44
17
  }) => {
45
18
  React.useEffect(() => {
46
19
  client.mount();
@@ -48,18 +21,10 @@ const QueryClientProvider = ({
48
21
  client.unmount();
49
22
  };
50
23
  }, [client]);
51
-
52
- if (process.env.NODE_ENV !== 'production' && contextSharing) {
53
- client.getLogger().error("The contextSharing option has been deprecated and will be removed in the next major version");
54
- }
55
-
56
- const Context = getQueryClientContext(context, contextSharing);
57
- return /*#__PURE__*/React.createElement(QueryClientSharingContext.Provider, {
58
- value: !context && contextSharing
59
- }, /*#__PURE__*/React.createElement(Context.Provider, {
24
+ return /*#__PURE__*/React.createElement(QueryClientContext.Provider, {
60
25
  value: client
61
- }, children));
26
+ }, children);
62
27
  };
63
28
 
64
- export { QueryClientProvider, defaultContext, useQueryClient };
29
+ export { QueryClientContext, QueryClientProvider, useQueryClient };
65
30
  //# sourceMappingURL=QueryClientProvider.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"QueryClientProvider.mjs","sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport type { QueryClient } from '@tanstack/query-core'\nimport type { ContextOptions } from './types'\n\ndeclare global {\n interface Window {\n ReactQueryClientContext?: React.Context<QueryClient | undefined>\n }\n}\n\nexport const defaultContext = React.createContext<QueryClient | undefined>(\n undefined,\n)\nconst QueryClientSharingContext = React.createContext<boolean>(false)\n\n// If we are given a context, we will use it.\n// Otherwise, if contextSharing is on, we share the first and at least one\n// instance of the context across the window\n// to ensure that if React Query is used across\n// different bundles or microfrontends they will\n// all use the same **instance** of context, regardless\n// of module scoping.\nfunction getQueryClientContext(\n context: React.Context<QueryClient | undefined> | undefined,\n contextSharing: boolean,\n) {\n if (context) {\n return context\n }\n if (contextSharing && typeof window !== 'undefined') {\n if (!window.ReactQueryClientContext) {\n window.ReactQueryClientContext = defaultContext\n }\n\n return window.ReactQueryClientContext\n }\n\n return defaultContext\n}\n\nexport const useQueryClient = ({ context }: ContextOptions = {}) => {\n const queryClient = React.useContext(\n getQueryClientContext(context, React.useContext(QueryClientSharingContext)),\n )\n\n if (!queryClient) {\n throw new Error('No QueryClient set, use QueryClientProvider to set one')\n }\n\n return queryClient\n}\n\ntype QueryClientProviderPropsBase = {\n client: QueryClient\n children?: React.ReactNode\n}\ntype QueryClientProviderPropsWithContext = ContextOptions & {\n contextSharing?: never\n} & QueryClientProviderPropsBase\ntype QueryClientProviderPropsWithContextSharing = {\n context?: never\n contextSharing?: boolean\n} & QueryClientProviderPropsBase\n\nexport type QueryClientProviderProps =\n | QueryClientProviderPropsWithContext\n | QueryClientProviderPropsWithContextSharing\n\nexport const QueryClientProvider = ({\n client,\n children,\n context,\n contextSharing = false,\n}: QueryClientProviderProps): JSX.Element => {\n React.useEffect(() => {\n client.mount()\n return () => {\n client.unmount()\n }\n }, [client])\n\n if (process.env.NODE_ENV !== 'production' && contextSharing) {\n client\n .getLogger()\n .error(\n `The contextSharing option has been deprecated and will be removed in the next major version`,\n )\n }\n\n const Context = getQueryClientContext(context, contextSharing)\n\n return (\n <QueryClientSharingContext.Provider value={!context && contextSharing}>\n <Context.Provider value={client}>{children}</Context.Provider>\n </QueryClientSharingContext.Provider>\n )\n}\n"],"names":["defaultContext","React","createContext","undefined","QueryClientSharingContext","getQueryClientContext","context","contextSharing","window","ReactQueryClientContext","useQueryClient","queryClient","useContext","Error","QueryClientProvider","client","children","useEffect","mount","unmount","process","env","NODE_ENV","getLogger","error","Context"],"mappings":";;AAYO,MAAMA,cAAc,gBAAGC,KAAK,CAACC,aAAN,CAC5BC,SAD4B,EAAvB;AAGP,MAAMC,yBAAyB,gBAAGH,KAAK,CAACC,aAAN,CAA6B,KAA7B,CAAlC;AAGA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASG,qBAAT,CACEC,OADF,EAEEC,cAFF,EAGE;AACA,EAAA,IAAID,OAAJ,EAAa;AACX,IAAA,OAAOA,OAAP,CAAA;AACD,GAAA;;AACD,EAAA,IAAIC,cAAc,IAAI,OAAOC,MAAP,KAAkB,WAAxC,EAAqD;AACnD,IAAA,IAAI,CAACA,MAAM,CAACC,uBAAZ,EAAqC;MACnCD,MAAM,CAACC,uBAAP,GAAiCT,cAAjC,CAAA;AACD,KAAA;;IAED,OAAOQ,MAAM,CAACC,uBAAd,CAAA;AACD,GAAA;;AAED,EAAA,OAAOT,cAAP,CAAA;AACD,CAAA;;AAEM,MAAMU,cAAc,GAAG,CAAC;AAAEJ,EAAAA,OAAAA;AAAF,CAAA,GAA8B,EAA/B,KAAsC;AAClE,EAAA,MAAMK,WAAW,GAAGV,KAAK,CAACW,UAAN,CAClBP,qBAAqB,CAACC,OAAD,EAAUL,KAAK,CAACW,UAAN,CAAiBR,yBAAjB,CAAV,CADH,CAApB,CAAA;;EAIA,IAAI,CAACO,WAAL,EAAkB;AAChB,IAAA,MAAM,IAAIE,KAAJ,CAAU,wDAAV,CAAN,CAAA;AACD,GAAA;;AAED,EAAA,OAAOF,WAAP,CAAA;AACD,EAVM;AA4BA,MAAMG,mBAAmB,GAAG,CAAC;EAClCC,MADkC;EAElCC,QAFkC;EAGlCV,OAHkC;AAIlCC,EAAAA,cAAc,GAAG,KAAA;AAJiB,CAAD,KAKU;EAC3CN,KAAK,CAACgB,SAAN,CAAgB,MAAM;AACpBF,IAAAA,MAAM,CAACG,KAAP,EAAA,CAAA;AACA,IAAA,OAAO,MAAM;AACXH,MAAAA,MAAM,CAACI,OAAP,EAAA,CAAA;KADF,CAAA;GAFF,EAKG,CAACJ,MAAD,CALH,CAAA,CAAA;;EAOA,IAAIK,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAAzB,IAAyCf,cAA7C,EAA6D;IAC3DQ,MAAM,CACHQ,SADH,EAAA,CAEGC,KAFH,CAAA,6FAAA,CAAA,CAAA;AAKD,GAAA;;AAED,EAAA,MAAMC,OAAO,GAAGpB,qBAAqB,CAACC,OAAD,EAAUC,cAAV,CAArC,CAAA;EAEA,oBACE,KAAA,CAAA,aAAA,CAAC,yBAAD,CAA2B,QAA3B,EAAA;IAAoC,KAAK,EAAE,CAACD,OAAD,IAAYC,cAAAA;GACrD,eAAA,KAAA,CAAA,aAAA,CAAC,OAAD,CAAS,QAAT,EAAA;AAAkB,IAAA,KAAK,EAAEQ,MAAAA;GAASC,EAAAA,QAAlC,CADF,CADF,CAAA;AAKD;;;;"}
1
+ {"version":3,"file":"QueryClientProvider.mjs","sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport type { QueryClient } from '@tanstack/query-core'\n\nexport const QueryClientContext = React.createContext<QueryClient | undefined>(\n undefined,\n)\n\nexport const useQueryClient = (queryClient?: QueryClient) => {\n const client = React.useContext(QueryClientContext)\n\n if (queryClient) {\n return queryClient\n }\n\n if (!client) {\n throw new Error('No QueryClient set, use QueryClientProvider to set one')\n }\n\n return client\n}\n\nexport type QueryClientProviderProps = {\n client: QueryClient\n children?: React.ReactNode\n}\n\nexport const QueryClientProvider = ({\n client,\n children,\n}: QueryClientProviderProps): JSX.Element => {\n React.useEffect(() => {\n client.mount()\n return () => {\n client.unmount()\n }\n }, [client])\n\n return (\n <QueryClientContext.Provider value={client}>\n {children}\n </QueryClientContext.Provider>\n )\n}\n"],"names":["QueryClientContext","React","createContext","undefined","useQueryClient","queryClient","client","useContext","Error","QueryClientProvider","children","useEffect","mount","unmount"],"mappings":";;AAKO,MAAMA,kBAAkB,gBAAGC,KAAK,CAACC,aAAa,CACnDC,SAAS,EACV;AAEYC,MAAAA,cAAc,GAAIC,WAAyB,IAAK;AAC3D,EAAA,MAAMC,MAAM,GAAGL,KAAK,CAACM,UAAU,CAACP,kBAAkB,CAAC,CAAA;AAEnD,EAAA,IAAIK,WAAW,EAAE;AACf,IAAA,OAAOA,WAAW,CAAA;AACpB,GAAA;EAEA,IAAI,CAACC,MAAM,EAAE;AACX,IAAA,MAAM,IAAIE,KAAK,CAAC,wDAAwD,CAAC,CAAA;AAC3E,GAAA;AAEA,EAAA,OAAOF,MAAM,CAAA;AACf,EAAC;AAOM,MAAMG,mBAAmB,GAAG,CAAC;EAClCH,MAAM;AACNI,EAAAA,QAAAA;AACwB,CAAC,KAAkB;EAC3CT,KAAK,CAACU,SAAS,CAAC,MAAM;IACpBL,MAAM,CAACM,KAAK,EAAE,CAAA;AACd,IAAA,OAAO,MAAM;MACXN,MAAM,CAACO,OAAO,EAAE,CAAA;KACjB,CAAA;AACH,GAAC,EAAE,CAACP,MAAM,CAAC,CAAC,CAAA;EAEZ,oBACE,KAAA,CAAA,aAAA,CAAC,kBAAkB,CAAC,QAAQ,EAAA;AAAC,IAAA,KAAK,EAAEA,MAAAA;AAAO,GAAA,EACxCI,QAAQ,CACmB,CAAA;AAElC;;;;"}
@@ -1,5 +1,7 @@
1
1
  import * as React from 'react';
2
2
 
3
+ // CONTEXT
4
+
3
5
  function createValue() {
4
6
  let isReset = false;
5
7
  return {
@@ -14,10 +16,13 @@ function createValue() {
14
16
  }
15
17
  };
16
18
  }
19
+ const QueryErrorResetBoundaryContext = /*#__PURE__*/React.createContext(createValue());
20
+
21
+ // HOOK
17
22
 
18
- const QueryErrorResetBoundaryContext = /*#__PURE__*/React.createContext(createValue()); // HOOK
23
+ const useQueryErrorResetBoundary = () => React.useContext(QueryErrorResetBoundaryContext);
19
24
 
20
- const useQueryErrorResetBoundary = () => React.useContext(QueryErrorResetBoundaryContext); // COMPONENT
25
+ // COMPONENT
21
26
 
22
27
  const QueryErrorResetBoundary = ({
23
28
  children
@@ -1 +1 @@
1
- {"version":3,"file":"QueryErrorResetBoundary.esm.js","sources":["../../src/QueryErrorResetBoundary.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\n// CONTEXT\n\nexport interface QueryErrorResetBoundaryValue {\n clearReset: () => void\n isReset: () => boolean\n reset: () => void\n}\n\nfunction createValue(): QueryErrorResetBoundaryValue {\n let isReset = false\n return {\n clearReset: () => {\n isReset = false\n },\n reset: () => {\n isReset = true\n },\n isReset: () => {\n return isReset\n },\n }\n}\n\nconst QueryErrorResetBoundaryContext = React.createContext(createValue())\n\n// HOOK\n\nexport const useQueryErrorResetBoundary = () =>\n React.useContext(QueryErrorResetBoundaryContext)\n\n// COMPONENT\n\nexport interface QueryErrorResetBoundaryProps {\n children:\n | ((value: QueryErrorResetBoundaryValue) => React.ReactNode)\n | React.ReactNode\n}\n\nexport const QueryErrorResetBoundary = ({\n children,\n}: QueryErrorResetBoundaryProps) => {\n const [value] = React.useState(() => createValue())\n return (\n <QueryErrorResetBoundaryContext.Provider value={value}>\n {typeof children === 'function'\n ? (children as Function)(value)\n : children}\n </QueryErrorResetBoundaryContext.Provider>\n )\n}\n"],"names":["createValue","isReset","clearReset","reset","QueryErrorResetBoundaryContext","React","createContext","useQueryErrorResetBoundary","useContext","QueryErrorResetBoundary","children","value","useState"],"mappings":";;AAWA,SAASA,WAAT,GAAqD;EACnD,IAAIC,OAAO,GAAG,KAAd,CAAA;EACA,OAAO;AACLC,IAAAA,UAAU,EAAE,MAAM;AAChBD,MAAAA,OAAO,GAAG,KAAV,CAAA;KAFG;AAILE,IAAAA,KAAK,EAAE,MAAM;AACXF,MAAAA,OAAO,GAAG,IAAV,CAAA;KALG;AAOLA,IAAAA,OAAO,EAAE,MAAM;AACb,MAAA,OAAOA,OAAP,CAAA;AACD,KAAA;GATH,CAAA;AAWD,CAAA;;AAED,MAAMG,8BAA8B,gBAAGC,KAAK,CAACC,aAAN,CAAoBN,WAAW,EAA/B,CAAvC;;AAIO,MAAMO,0BAA0B,GAAG,MACxCF,KAAK,CAACG,UAAN,CAAiBJ,8BAAjB;;AAUK,MAAMK,uBAAuB,GAAG,CAAC;AACtCC,EAAAA,QAAAA;AADsC,CAAD,KAEH;EAClC,MAAM,CAACC,KAAD,CAAA,GAAUN,KAAK,CAACO,QAAN,CAAe,MAAMZ,WAAW,EAAhC,CAAhB,CAAA;EACA,oBACE,KAAA,CAAA,aAAA,CAAC,8BAAD,CAAgC,QAAhC,EAAA;AAAyC,IAAA,KAAK,EAAEW,KAAAA;GAC7C,EAAA,OAAOD,QAAP,KAAoB,UAApB,GACIA,QAAD,CAAuBC,KAAvB,CADH,GAEGD,QAHN,CADF,CAAA;AAOD;;;;"}
1
+ {"version":3,"file":"QueryErrorResetBoundary.esm.js","sources":["../../src/QueryErrorResetBoundary.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\n// CONTEXT\n\nexport interface QueryErrorResetBoundaryValue {\n clearReset: () => void\n isReset: () => boolean\n reset: () => void\n}\n\nfunction createValue(): QueryErrorResetBoundaryValue {\n let isReset = false\n return {\n clearReset: () => {\n isReset = false\n },\n reset: () => {\n isReset = true\n },\n isReset: () => {\n return isReset\n },\n }\n}\n\nconst QueryErrorResetBoundaryContext = React.createContext(createValue())\n\n// HOOK\n\nexport const useQueryErrorResetBoundary = () =>\n React.useContext(QueryErrorResetBoundaryContext)\n\n// COMPONENT\n\nexport interface QueryErrorResetBoundaryProps {\n children:\n | ((value: QueryErrorResetBoundaryValue) => React.ReactNode)\n | React.ReactNode\n}\n\nexport const QueryErrorResetBoundary = ({\n children,\n}: QueryErrorResetBoundaryProps) => {\n const [value] = React.useState(() => createValue())\n return (\n <QueryErrorResetBoundaryContext.Provider value={value}>\n {typeof children === 'function'\n ? (children as Function)(value)\n : children}\n </QueryErrorResetBoundaryContext.Provider>\n )\n}\n"],"names":["createValue","isReset","clearReset","reset","QueryErrorResetBoundaryContext","React","createContext","useQueryErrorResetBoundary","useContext","QueryErrorResetBoundary","children","value","useState"],"mappings":";;AAGA;;AAQA,SAASA,WAAW,GAAiC;EACnD,IAAIC,OAAO,GAAG,KAAK,CAAA;EACnB,OAAO;AACLC,IAAAA,UAAU,EAAE,MAAM;AAChBD,MAAAA,OAAO,GAAG,KAAK,CAAA;KAChB;AACDE,IAAAA,KAAK,EAAE,MAAM;AACXF,MAAAA,OAAO,GAAG,IAAI,CAAA;KACf;AACDA,IAAAA,OAAO,EAAE,MAAM;AACb,MAAA,OAAOA,OAAO,CAAA;AAChB,KAAA;GACD,CAAA;AACH,CAAA;AAEA,MAAMG,8BAA8B,gBAAGC,KAAK,CAACC,aAAa,CAACN,WAAW,EAAE,CAAC,CAAA;;AAEzE;;AAEO,MAAMO,0BAA0B,GAAG,MACxCF,KAAK,CAACG,UAAU,CAACJ,8BAA8B,EAAC;;AAElD;;AAQO,MAAMK,uBAAuB,GAAG,CAAC;AACtCC,EAAAA,QAAAA;AAC4B,CAAC,KAAK;EAClC,MAAM,CAACC,KAAK,CAAC,GAAGN,KAAK,CAACO,QAAQ,CAAC,MAAMZ,WAAW,EAAE,CAAC,CAAA;EACnD,oBACE,KAAA,CAAA,aAAA,CAAC,8BAA8B,CAAC,QAAQ,EAAA;AAAC,IAAA,KAAK,EAAEW,KAAAA;GAC7C,EAAA,OAAOD,QAAQ,KAAK,UAAU,GAC1BA,QAAQ,CAAcC,KAAK,CAAC,GAC7BD,QAAQ,CAC4B,CAAA;AAE9C;;;;"}
@@ -1,11 +1,8 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var React = require('react');
6
4
 
7
- function _interopNamespace(e) {
8
- if (e && e.__esModule) return e;
5
+ function _interopNamespaceDefault(e) {
9
6
  var n = Object.create(null);
10
7
  if (e) {
11
8
  Object.keys(e).forEach(function (k) {
@@ -18,11 +15,13 @@ function _interopNamespace(e) {
18
15
  }
19
16
  });
20
17
  }
21
- n["default"] = e;
18
+ n.default = e;
22
19
  return Object.freeze(n);
23
20
  }
24
21
 
25
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
22
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
23
+
24
+ // CONTEXT
26
25
 
27
26
  function createValue() {
28
27
  let isReset = false;
@@ -38,10 +37,13 @@ function createValue() {
38
37
  }
39
38
  };
40
39
  }
40
+ const QueryErrorResetBoundaryContext = /*#__PURE__*/React__namespace.createContext(createValue());
41
+
42
+ // HOOK
41
43
 
42
- const QueryErrorResetBoundaryContext = /*#__PURE__*/React__namespace.createContext(createValue()); // HOOK
44
+ const useQueryErrorResetBoundary = () => React__namespace.useContext(QueryErrorResetBoundaryContext);
43
45
 
44
- const useQueryErrorResetBoundary = () => React__namespace.useContext(QueryErrorResetBoundaryContext); // COMPONENT
46
+ // COMPONENT
45
47
 
46
48
  const QueryErrorResetBoundary = ({
47
49
  children