@depup/tanstack__react-query 5.91.0-depup.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/LICENSE +21 -0
- package/README.md +25 -0
- package/build/codemods/src/utils/index.cjs +208 -0
- package/build/codemods/src/utils/transformers/query-cache-transformer.cjs +124 -0
- package/build/codemods/src/utils/transformers/query-client-transformer.cjs +53 -0
- package/build/codemods/src/utils/transformers/use-query-like-transformer.cjs +38 -0
- package/build/codemods/src/v4/key-transformation.cjs +181 -0
- package/build/codemods/src/v4/replace-import-specifier.cjs +25 -0
- package/build/codemods/src/v4/utils/replacers/key-replacer.cjs +164 -0
- package/build/codemods/src/v5/is-loading/is-loading.cjs +244 -0
- package/build/codemods/src/v5/keep-previous-data/README.md +32 -0
- package/build/codemods/src/v5/keep-previous-data/keep-previous-data.cjs +271 -0
- package/build/codemods/src/v5/keep-previous-data/utils/already-has-placeholder-data-property.cjs +26 -0
- package/build/codemods/src/v5/remove-overloads/remove-overloads.cjs +58 -0
- package/build/codemods/src/v5/remove-overloads/transformers/filter-aware-usage-transformer.cjs +271 -0
- package/build/codemods/src/v5/remove-overloads/transformers/query-fn-aware-usage-transformer.cjs +185 -0
- package/build/codemods/src/v5/remove-overloads/utils/index.cjs +123 -0
- package/build/codemods/src/v5/remove-overloads/utils/unknown-usage-error.cjs +27 -0
- package/build/codemods/src/v5/rename-hydrate/rename-hydrate.cjs +55 -0
- package/build/codemods/src/v5/rename-properties/rename-properties.cjs +41 -0
- package/build/legacy/HydrationBoundary.cjs +91 -0
- package/build/legacy/HydrationBoundary.cjs.map +1 -0
- package/build/legacy/HydrationBoundary.d.cts +2 -0
- package/build/legacy/HydrationBoundary.d.ts +2 -0
- package/build/legacy/HydrationBoundary.js +57 -0
- package/build/legacy/HydrationBoundary.js.map +1 -0
- package/build/legacy/IsRestoringProvider.cjs +47 -0
- package/build/legacy/IsRestoringProvider.cjs.map +1 -0
- package/build/legacy/IsRestoringProvider.d.cts +2 -0
- package/build/legacy/IsRestoringProvider.d.ts +2 -0
- package/build/legacy/IsRestoringProvider.js +12 -0
- package/build/legacy/IsRestoringProvider.js.map +1 -0
- package/build/legacy/QueryClientProvider.cjs +72 -0
- package/build/legacy/QueryClientProvider.cjs.map +1 -0
- package/build/legacy/QueryClientProvider.d.cts +4 -0
- package/build/legacy/QueryClientProvider.d.ts +4 -0
- package/build/legacy/QueryClientProvider.js +36 -0
- package/build/legacy/QueryClientProvider.js.map +1 -0
- package/build/legacy/QueryErrorResetBoundary.cjs +67 -0
- package/build/legacy/QueryErrorResetBoundary.cjs.map +1 -0
- package/build/legacy/QueryErrorResetBoundary.d.cts +8 -0
- package/build/legacy/QueryErrorResetBoundary.d.ts +8 -0
- package/build/legacy/QueryErrorResetBoundary.js +32 -0
- package/build/legacy/QueryErrorResetBoundary.js.map +1 -0
- package/build/legacy/_tsup-dts-rollup.d.cts +993 -0
- package/build/legacy/_tsup-dts-rollup.d.ts +993 -0
- package/build/legacy/errorBoundaryUtils.cjs +69 -0
- package/build/legacy/errorBoundaryUtils.cjs.map +1 -0
- package/build/legacy/errorBoundaryUtils.d.cts +3 -0
- package/build/legacy/errorBoundaryUtils.d.ts +3 -0
- package/build/legacy/errorBoundaryUtils.js +33 -0
- package/build/legacy/errorBoundaryUtils.js.map +1 -0
- package/build/legacy/index.cjs +97 -0
- package/build/legacy/index.cjs.map +1 -0
- package/build/legacy/index.d.cts +206 -0
- package/build/legacy/index.d.ts +206 -0
- package/build/legacy/index.js +54 -0
- package/build/legacy/index.js.map +1 -0
- package/build/legacy/infiniteQueryOptions.cjs +33 -0
- package/build/legacy/infiniteQueryOptions.cjs.map +1 -0
- package/build/legacy/infiniteQueryOptions.d.cts +4 -0
- package/build/legacy/infiniteQueryOptions.d.ts +4 -0
- package/build/legacy/infiniteQueryOptions.js +8 -0
- package/build/legacy/infiniteQueryOptions.js.map +1 -0
- package/build/legacy/mutationOptions.cjs +33 -0
- package/build/legacy/mutationOptions.cjs.map +1 -0
- package/build/legacy/mutationOptions.d.cts +1 -0
- package/build/legacy/mutationOptions.d.ts +1 -0
- package/build/legacy/mutationOptions.js +8 -0
- package/build/legacy/mutationOptions.js.map +1 -0
- package/build/legacy/queryOptions.cjs +33 -0
- package/build/legacy/queryOptions.cjs.map +1 -0
- package/build/legacy/queryOptions.d.cts +4 -0
- package/build/legacy/queryOptions.d.ts +4 -0
- package/build/legacy/queryOptions.js +8 -0
- package/build/legacy/queryOptions.js.map +1 -0
- package/build/legacy/suspense.cjs +58 -0
- package/build/legacy/suspense.cjs.map +1 -0
- package/build/legacy/suspense.d.cts +5 -0
- package/build/legacy/suspense.d.ts +5 -0
- package/build/legacy/suspense.js +29 -0
- package/build/legacy/suspense.js.map +1 -0
- package/build/legacy/types.cjs +19 -0
- package/build/legacy/types.cjs.map +1 -0
- package/build/legacy/types.d.cts +24 -0
- package/build/legacy/types.d.ts +24 -0
- package/build/legacy/types.js +1 -0
- package/build/legacy/types.js.map +1 -0
- package/build/legacy/useBaseQuery.cjs +133 -0
- package/build/legacy/useBaseQuery.cjs.map +1 -0
- package/build/legacy/useBaseQuery.d.cts +1 -0
- package/build/legacy/useBaseQuery.d.ts +1 -0
- package/build/legacy/useBaseQuery.js +108 -0
- package/build/legacy/useBaseQuery.js.map +1 -0
- package/build/legacy/useInfiniteQuery.cjs +40 -0
- package/build/legacy/useInfiniteQuery.cjs.map +1 -0
- package/build/legacy/useInfiniteQuery.d.cts +1 -0
- package/build/legacy/useInfiniteQuery.d.ts +1 -0
- package/build/legacy/useInfiniteQuery.js +16 -0
- package/build/legacy/useInfiniteQuery.js.map +1 -0
- package/build/legacy/useIsFetching.cjs +56 -0
- package/build/legacy/useIsFetching.cjs.map +1 -0
- package/build/legacy/useIsFetching.d.cts +1 -0
- package/build/legacy/useIsFetching.d.ts +1 -0
- package/build/legacy/useIsFetching.js +22 -0
- package/build/legacy/useIsFetching.js.map +1 -0
- package/build/legacy/useMutation.cjs +74 -0
- package/build/legacy/useMutation.cjs.map +1 -0
- package/build/legacy/useMutation.d.cts +1 -0
- package/build/legacy/useMutation.d.ts +1 -0
- package/build/legacy/useMutation.js +45 -0
- package/build/legacy/useMutation.js.map +1 -0
- package/build/legacy/useMutationState.cjs +86 -0
- package/build/legacy/useMutationState.cjs.map +1 -0
- package/build/legacy/useMutationState.d.cts +2 -0
- package/build/legacy/useMutationState.d.ts +2 -0
- package/build/legacy/useMutationState.js +51 -0
- package/build/legacy/useMutationState.js.map +1 -0
- package/build/legacy/usePrefetchInfiniteQuery.cjs +37 -0
- package/build/legacy/usePrefetchInfiniteQuery.cjs.map +1 -0
- package/build/legacy/usePrefetchInfiniteQuery.d.cts +1 -0
- package/build/legacy/usePrefetchInfiniteQuery.d.ts +1 -0
- package/build/legacy/usePrefetchInfiniteQuery.js +12 -0
- package/build/legacy/usePrefetchInfiniteQuery.js.map +1 -0
- package/build/legacy/usePrefetchQuery.cjs +37 -0
- package/build/legacy/usePrefetchQuery.cjs.map +1 -0
- package/build/legacy/usePrefetchQuery.d.cts +1 -0
- package/build/legacy/usePrefetchQuery.d.ts +1 -0
- package/build/legacy/usePrefetchQuery.js +12 -0
- package/build/legacy/usePrefetchQuery.js.map +1 -0
- package/build/legacy/useQueries.cjs +128 -0
- package/build/legacy/useQueries.cjs.map +1 -0
- package/build/legacy/useQueries.d.cts +3 -0
- package/build/legacy/useQueries.d.ts +3 -0
- package/build/legacy/useQueries.js +107 -0
- package/build/legacy/useQueries.js.map +1 -0
- package/build/legacy/useQuery.cjs +36 -0
- package/build/legacy/useQuery.cjs.map +1 -0
- package/build/legacy/useQuery.d.cts +1 -0
- package/build/legacy/useQuery.d.ts +1 -0
- package/build/legacy/useQuery.js +12 -0
- package/build/legacy/useQuery.js.map +1 -0
- package/build/legacy/useSuspenseInfiniteQuery.cjs +51 -0
- package/build/legacy/useSuspenseInfiniteQuery.cjs.map +1 -0
- package/build/legacy/useSuspenseInfiniteQuery.d.cts +1 -0
- package/build/legacy/useSuspenseInfiniteQuery.d.ts +1 -0
- package/build/legacy/useSuspenseInfiniteQuery.js +27 -0
- package/build/legacy/useSuspenseInfiniteQuery.js.map +1 -0
- package/build/legacy/useSuspenseQueries.cjs +56 -0
- package/build/legacy/useSuspenseQueries.cjs.map +1 -0
- package/build/legacy/useSuspenseQueries.d.cts +3 -0
- package/build/legacy/useSuspenseQueries.d.ts +3 -0
- package/build/legacy/useSuspenseQueries.js +32 -0
- package/build/legacy/useSuspenseQueries.js.map +1 -0
- package/build/legacy/useSuspenseQuery.cjs +52 -0
- package/build/legacy/useSuspenseQuery.cjs.map +1 -0
- package/build/legacy/useSuspenseQuery.d.cts +1 -0
- package/build/legacy/useSuspenseQuery.d.ts +1 -0
- package/build/legacy/useSuspenseQuery.js +28 -0
- package/build/legacy/useSuspenseQuery.js.map +1 -0
- package/build/modern/HydrationBoundary.cjs +91 -0
- package/build/modern/HydrationBoundary.cjs.map +1 -0
- package/build/modern/HydrationBoundary.d.cts +2 -0
- package/build/modern/HydrationBoundary.d.ts +2 -0
- package/build/modern/HydrationBoundary.js +57 -0
- package/build/modern/HydrationBoundary.js.map +1 -0
- package/build/modern/IsRestoringProvider.cjs +47 -0
- package/build/modern/IsRestoringProvider.cjs.map +1 -0
- package/build/modern/IsRestoringProvider.d.cts +2 -0
- package/build/modern/IsRestoringProvider.d.ts +2 -0
- package/build/modern/IsRestoringProvider.js +12 -0
- package/build/modern/IsRestoringProvider.js.map +1 -0
- package/build/modern/QueryClientProvider.cjs +72 -0
- package/build/modern/QueryClientProvider.cjs.map +1 -0
- package/build/modern/QueryClientProvider.d.cts +4 -0
- package/build/modern/QueryClientProvider.d.ts +4 -0
- package/build/modern/QueryClientProvider.js +36 -0
- package/build/modern/QueryClientProvider.js.map +1 -0
- package/build/modern/QueryErrorResetBoundary.cjs +67 -0
- package/build/modern/QueryErrorResetBoundary.cjs.map +1 -0
- package/build/modern/QueryErrorResetBoundary.d.cts +8 -0
- package/build/modern/QueryErrorResetBoundary.d.ts +8 -0
- package/build/modern/QueryErrorResetBoundary.js +32 -0
- package/build/modern/QueryErrorResetBoundary.js.map +1 -0
- package/build/modern/_tsup-dts-rollup.d.cts +993 -0
- package/build/modern/_tsup-dts-rollup.d.ts +993 -0
- package/build/modern/errorBoundaryUtils.cjs +69 -0
- package/build/modern/errorBoundaryUtils.cjs.map +1 -0
- package/build/modern/errorBoundaryUtils.d.cts +3 -0
- package/build/modern/errorBoundaryUtils.d.ts +3 -0
- package/build/modern/errorBoundaryUtils.js +33 -0
- package/build/modern/errorBoundaryUtils.js.map +1 -0
- package/build/modern/index.cjs +97 -0
- package/build/modern/index.cjs.map +1 -0
- package/build/modern/index.d.cts +206 -0
- package/build/modern/index.d.ts +206 -0
- package/build/modern/index.js +54 -0
- package/build/modern/index.js.map +1 -0
- package/build/modern/infiniteQueryOptions.cjs +33 -0
- package/build/modern/infiniteQueryOptions.cjs.map +1 -0
- package/build/modern/infiniteQueryOptions.d.cts +4 -0
- package/build/modern/infiniteQueryOptions.d.ts +4 -0
- package/build/modern/infiniteQueryOptions.js +8 -0
- package/build/modern/infiniteQueryOptions.js.map +1 -0
- package/build/modern/mutationOptions.cjs +33 -0
- package/build/modern/mutationOptions.cjs.map +1 -0
- package/build/modern/mutationOptions.d.cts +1 -0
- package/build/modern/mutationOptions.d.ts +1 -0
- package/build/modern/mutationOptions.js +8 -0
- package/build/modern/mutationOptions.js.map +1 -0
- package/build/modern/queryOptions.cjs +33 -0
- package/build/modern/queryOptions.cjs.map +1 -0
- package/build/modern/queryOptions.d.cts +4 -0
- package/build/modern/queryOptions.d.ts +4 -0
- package/build/modern/queryOptions.js +8 -0
- package/build/modern/queryOptions.js.map +1 -0
- package/build/modern/suspense.cjs +58 -0
- package/build/modern/suspense.cjs.map +1 -0
- package/build/modern/suspense.d.cts +5 -0
- package/build/modern/suspense.d.ts +5 -0
- package/build/modern/suspense.js +29 -0
- package/build/modern/suspense.js.map +1 -0
- package/build/modern/types.cjs +19 -0
- package/build/modern/types.cjs.map +1 -0
- package/build/modern/types.d.cts +24 -0
- package/build/modern/types.d.ts +24 -0
- package/build/modern/types.js +1 -0
- package/build/modern/types.js.map +1 -0
- package/build/modern/useBaseQuery.cjs +130 -0
- package/build/modern/useBaseQuery.cjs.map +1 -0
- package/build/modern/useBaseQuery.d.cts +1 -0
- package/build/modern/useBaseQuery.d.ts +1 -0
- package/build/modern/useBaseQuery.js +105 -0
- package/build/modern/useBaseQuery.js.map +1 -0
- package/build/modern/useInfiniteQuery.cjs +40 -0
- package/build/modern/useInfiniteQuery.cjs.map +1 -0
- package/build/modern/useInfiniteQuery.d.cts +1 -0
- package/build/modern/useInfiniteQuery.d.ts +1 -0
- package/build/modern/useInfiniteQuery.js +16 -0
- package/build/modern/useInfiniteQuery.js.map +1 -0
- package/build/modern/useIsFetching.cjs +56 -0
- package/build/modern/useIsFetching.cjs.map +1 -0
- package/build/modern/useIsFetching.d.cts +1 -0
- package/build/modern/useIsFetching.d.ts +1 -0
- package/build/modern/useIsFetching.js +22 -0
- package/build/modern/useIsFetching.js.map +1 -0
- package/build/modern/useMutation.cjs +74 -0
- package/build/modern/useMutation.cjs.map +1 -0
- package/build/modern/useMutation.d.cts +1 -0
- package/build/modern/useMutation.d.ts +1 -0
- package/build/modern/useMutation.js +45 -0
- package/build/modern/useMutation.js.map +1 -0
- package/build/modern/useMutationState.cjs +86 -0
- package/build/modern/useMutationState.cjs.map +1 -0
- package/build/modern/useMutationState.d.cts +2 -0
- package/build/modern/useMutationState.d.ts +2 -0
- package/build/modern/useMutationState.js +51 -0
- package/build/modern/useMutationState.js.map +1 -0
- package/build/modern/usePrefetchInfiniteQuery.cjs +37 -0
- package/build/modern/usePrefetchInfiniteQuery.cjs.map +1 -0
- package/build/modern/usePrefetchInfiniteQuery.d.cts +1 -0
- package/build/modern/usePrefetchInfiniteQuery.d.ts +1 -0
- package/build/modern/usePrefetchInfiniteQuery.js +12 -0
- package/build/modern/usePrefetchInfiniteQuery.js.map +1 -0
- package/build/modern/usePrefetchQuery.cjs +37 -0
- package/build/modern/usePrefetchQuery.cjs.map +1 -0
- package/build/modern/usePrefetchQuery.d.cts +1 -0
- package/build/modern/usePrefetchQuery.d.ts +1 -0
- package/build/modern/usePrefetchQuery.js +12 -0
- package/build/modern/usePrefetchQuery.js.map +1 -0
- package/build/modern/useQueries.cjs +128 -0
- package/build/modern/useQueries.cjs.map +1 -0
- package/build/modern/useQueries.d.cts +3 -0
- package/build/modern/useQueries.d.ts +3 -0
- package/build/modern/useQueries.js +107 -0
- package/build/modern/useQueries.js.map +1 -0
- package/build/modern/useQuery.cjs +36 -0
- package/build/modern/useQuery.cjs.map +1 -0
- package/build/modern/useQuery.d.cts +1 -0
- package/build/modern/useQuery.d.ts +1 -0
- package/build/modern/useQuery.js +12 -0
- package/build/modern/useQuery.js.map +1 -0
- package/build/modern/useSuspenseInfiniteQuery.cjs +51 -0
- package/build/modern/useSuspenseInfiniteQuery.cjs.map +1 -0
- package/build/modern/useSuspenseInfiniteQuery.d.cts +1 -0
- package/build/modern/useSuspenseInfiniteQuery.d.ts +1 -0
- package/build/modern/useSuspenseInfiniteQuery.js +27 -0
- package/build/modern/useSuspenseInfiniteQuery.js.map +1 -0
- package/build/modern/useSuspenseQueries.cjs +56 -0
- package/build/modern/useSuspenseQueries.cjs.map +1 -0
- package/build/modern/useSuspenseQueries.d.cts +3 -0
- package/build/modern/useSuspenseQueries.d.ts +3 -0
- package/build/modern/useSuspenseQueries.js +32 -0
- package/build/modern/useSuspenseQueries.js.map +1 -0
- package/build/modern/useSuspenseQuery.cjs +52 -0
- package/build/modern/useSuspenseQuery.cjs.map +1 -0
- package/build/modern/useSuspenseQuery.d.cts +1 -0
- package/build/modern/useSuspenseQuery.d.ts +1 -0
- package/build/modern/useSuspenseQuery.js +28 -0
- package/build/modern/useSuspenseQuery.js.map +1 -0
- package/build/query-codemods/eslint.config.js +18 -0
- package/build/query-codemods/package.json +38 -0
- package/build/query-codemods/root.eslint.config.js +64 -0
- package/build/query-codemods/tsconfig.json +8 -0
- package/build/query-codemods/vite.config.ts +30 -0
- package/changes.json +5 -0
- package/package.json +104 -0
- package/src/HydrationBoundary.tsx +111 -0
- package/src/IsRestoringProvider.ts +7 -0
- package/src/QueryClientProvider.tsx +45 -0
- package/src/QueryErrorResetBoundary.tsx +56 -0
- package/src/errorBoundaryUtils.ts +82 -0
- package/src/index.ts +56 -0
- package/src/infiniteQueryOptions.ts +149 -0
- package/src/mutationOptions.ts +41 -0
- package/src/queryOptions.ts +87 -0
- package/src/suspense.ts +80 -0
- package/src/types.ts +242 -0
- package/src/useBaseQuery.ts +170 -0
- package/src/useInfiniteQuery.ts +81 -0
- package/src/useIsFetching.ts +24 -0
- package/src/useMutation.ts +69 -0
- package/src/useMutationState.ts +75 -0
- package/src/usePrefetchInfiniteQuery.tsx +30 -0
- package/src/usePrefetchQuery.tsx +19 -0
- package/src/useQueries.ts +328 -0
- package/src/useQuery.ts +52 -0
- package/src/useSuspenseInfiniteQuery.ts +50 -0
- package/src/useSuspenseQueries.ts +211 -0
- package/src/useSuspenseQuery.ts +34 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
module.exports = (file, api) => {
|
|
2
|
+
const jscodeshift = api.jscodeshift
|
|
3
|
+
const root = jscodeshift(file.source)
|
|
4
|
+
|
|
5
|
+
const importSpecifiers = root
|
|
6
|
+
.find(jscodeshift.ImportDeclaration, {
|
|
7
|
+
source: {
|
|
8
|
+
value: '@tanstack/react-query',
|
|
9
|
+
},
|
|
10
|
+
})
|
|
11
|
+
.find(jscodeshift.ImportSpecifier, {
|
|
12
|
+
imported: {
|
|
13
|
+
name: 'Hydrate',
|
|
14
|
+
},
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
if (importSpecifiers.length > 0) {
|
|
18
|
+
const names = {
|
|
19
|
+
searched: 'Hydrate', // By default, we want to replace the `Hydrate` usages.
|
|
20
|
+
target: 'HydrationBoundary', // We want to replace them with `HydrationBoundary`.
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
importSpecifiers.replaceWith(({ node: mutableNode }) => {
|
|
24
|
+
/**
|
|
25
|
+
* When the local and imported names match which means the code doesn't contain import aliases, we need
|
|
26
|
+
* to replace only the import specifier.
|
|
27
|
+
* @type {boolean}
|
|
28
|
+
*/
|
|
29
|
+
const usesDefaultImport =
|
|
30
|
+
mutableNode.local.name === mutableNode.imported.name
|
|
31
|
+
|
|
32
|
+
if (!usesDefaultImport) {
|
|
33
|
+
// If the code uses import aliases, we must re-use the alias.
|
|
34
|
+
names.searched = mutableNode.local.name
|
|
35
|
+
names.target = mutableNode.local.name
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Override the import specifier.
|
|
39
|
+
mutableNode.imported.name = 'HydrationBoundary'
|
|
40
|
+
|
|
41
|
+
return mutableNode
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
root
|
|
45
|
+
.findJSXElements(names.searched)
|
|
46
|
+
.replaceWith(({ node: mutableNode }) => {
|
|
47
|
+
mutableNode.openingElement.name.name = names.target
|
|
48
|
+
mutableNode.closingElement.name.name = names.target
|
|
49
|
+
|
|
50
|
+
return mutableNode
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return root.toSource({ quote: 'single', lineTerminator: '\n' })
|
|
55
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
module.exports = (file, api) => {
|
|
2
|
+
const jscodeshift = api.jscodeshift
|
|
3
|
+
const root = jscodeshift(file.source)
|
|
4
|
+
|
|
5
|
+
const baseRenameLogic = (kind, from, to) => {
|
|
6
|
+
root
|
|
7
|
+
.find(kind, (node) => {
|
|
8
|
+
return (
|
|
9
|
+
node.computed === false &&
|
|
10
|
+
(node.key?.name === from || node.key?.value === from)
|
|
11
|
+
)
|
|
12
|
+
})
|
|
13
|
+
.replaceWith(({ node: mutableNode }) => {
|
|
14
|
+
if (mutableNode.key.name !== undefined) {
|
|
15
|
+
mutableNode.key.name = to
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (mutableNode.key.value !== undefined) {
|
|
19
|
+
mutableNode.key.value = to
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return mutableNode
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const renameObjectProperty = (from, to) => {
|
|
27
|
+
baseRenameLogic(jscodeshift.ObjectProperty, from, to)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const renameTypeScriptPropertySignature = (from, to) => {
|
|
31
|
+
baseRenameLogic(jscodeshift.TSPropertySignature, from, to)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
renameObjectProperty('cacheTime', 'gcTime')
|
|
35
|
+
renameObjectProperty('useErrorBoundary', 'throwOnError')
|
|
36
|
+
|
|
37
|
+
renameTypeScriptPropertySignature('cacheTime', 'gcTime')
|
|
38
|
+
renameTypeScriptPropertySignature('useErrorBoundary', 'throwOnError')
|
|
39
|
+
|
|
40
|
+
return root.toSource({ quote: 'single', lineTerminator: '\n' })
|
|
41
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/HydrationBoundary.tsx
|
|
32
|
+
var HydrationBoundary_exports = {};
|
|
33
|
+
__export(HydrationBoundary_exports, {
|
|
34
|
+
HydrationBoundary: () => HydrationBoundary
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(HydrationBoundary_exports);
|
|
37
|
+
var React = __toESM(require("react"), 1);
|
|
38
|
+
var import_query_core = require("@tanstack/query-core");
|
|
39
|
+
var import_QueryClientProvider = require("./QueryClientProvider.cjs");
|
|
40
|
+
var HydrationBoundary = ({
|
|
41
|
+
children,
|
|
42
|
+
options = {},
|
|
43
|
+
state,
|
|
44
|
+
queryClient
|
|
45
|
+
}) => {
|
|
46
|
+
const client = (0, import_QueryClientProvider.useQueryClient)(queryClient);
|
|
47
|
+
const optionsRef = React.useRef(options);
|
|
48
|
+
React.useEffect(() => {
|
|
49
|
+
optionsRef.current = options;
|
|
50
|
+
});
|
|
51
|
+
const hydrationQueue = React.useMemo(() => {
|
|
52
|
+
if (state) {
|
|
53
|
+
if (typeof state !== "object") {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const queryCache = client.getQueryCache();
|
|
57
|
+
const queries = state.queries || [];
|
|
58
|
+
const newQueries = [];
|
|
59
|
+
const existingQueries = [];
|
|
60
|
+
for (const dehydratedQuery of queries) {
|
|
61
|
+
const existingQuery = queryCache.get(dehydratedQuery.queryHash);
|
|
62
|
+
if (!existingQuery) {
|
|
63
|
+
newQueries.push(dehydratedQuery);
|
|
64
|
+
} else {
|
|
65
|
+
const hydrationIsNewer = dehydratedQuery.state.dataUpdatedAt > existingQuery.state.dataUpdatedAt || dehydratedQuery.promise && existingQuery.state.status !== "pending" && existingQuery.state.fetchStatus !== "fetching" && dehydratedQuery.dehydratedAt !== void 0 && dehydratedQuery.dehydratedAt > existingQuery.state.dataUpdatedAt;
|
|
66
|
+
if (hydrationIsNewer) {
|
|
67
|
+
existingQueries.push(dehydratedQuery);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (newQueries.length > 0) {
|
|
72
|
+
(0, import_query_core.hydrate)(client, { queries: newQueries }, optionsRef.current);
|
|
73
|
+
}
|
|
74
|
+
if (existingQueries.length > 0) {
|
|
75
|
+
return existingQueries;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return void 0;
|
|
79
|
+
}, [client, state]);
|
|
80
|
+
React.useEffect(() => {
|
|
81
|
+
if (hydrationQueue) {
|
|
82
|
+
(0, import_query_core.hydrate)(client, { queries: hydrationQueue }, optionsRef.current);
|
|
83
|
+
}
|
|
84
|
+
}, [client, hydrationQueue]);
|
|
85
|
+
return children;
|
|
86
|
+
};
|
|
87
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
88
|
+
0 && (module.exports = {
|
|
89
|
+
HydrationBoundary
|
|
90
|
+
});
|
|
91
|
+
//# sourceMappingURL=HydrationBoundary.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/HydrationBoundary.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport { hydrate } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type {\n DehydratedState,\n HydrateOptions,\n OmitKeyof,\n QueryClient,\n} from '@tanstack/query-core'\n\nexport interface HydrationBoundaryProps {\n state: DehydratedState | null | undefined\n options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & {\n defaultOptions?: OmitKeyof<\n Exclude<HydrateOptions['defaultOptions'], undefined>,\n 'mutations'\n >\n }\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 React.useEffect(() => {\n optionsRef.current = options\n })\n\n // This useMemo is for performance reasons only, everything inside it must\n // be safe to run in every render and code here should be read as \"in render\".\n //\n // This code needs to happen during the render phase, because after initial\n // SSR, hydration needs to happen _before_ children render. Also, if hydrating\n // during a transition, we want to hydrate as much as is safe in render so\n // we can prerender as much as possible.\n //\n // For any queries that already exist in the cache, we want to hold back on\n // hydrating until _after_ the render phase. The reason for this is that during\n // transitions, we don't want the existing queries and observers to update to\n // the new data on the current page, only _after_ the transition is committed.\n // If the transition is aborted, we will have hydrated any _new_ queries, but\n // we throw away the fresh data for any existing ones to avoid unexpectedly\n // updating the UI.\n const hydrationQueue: DehydratedState['queries'] | undefined =\n React.useMemo(() => {\n if (state) {\n if (typeof state !== 'object') {\n return\n }\n\n const queryCache = client.getQueryCache()\n // State is supplied from the outside and we might as well fail\n // gracefully if it has the wrong shape, so while we type `queries`\n // as required, we still provide a fallback.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const queries = state.queries || []\n\n const newQueries: DehydratedState['queries'] = []\n const existingQueries: DehydratedState['queries'] = []\n for (const dehydratedQuery of queries) {\n const existingQuery = queryCache.get(dehydratedQuery.queryHash)\n\n if (!existingQuery) {\n newQueries.push(dehydratedQuery)\n } else {\n const hydrationIsNewer =\n dehydratedQuery.state.dataUpdatedAt >\n existingQuery.state.dataUpdatedAt ||\n (dehydratedQuery.promise &&\n existingQuery.state.status !== 'pending' &&\n existingQuery.state.fetchStatus !== 'fetching' &&\n dehydratedQuery.dehydratedAt !== undefined &&\n dehydratedQuery.dehydratedAt >\n existingQuery.state.dataUpdatedAt)\n\n if (hydrationIsNewer) {\n existingQueries.push(dehydratedQuery)\n }\n }\n }\n\n if (newQueries.length > 0) {\n // It's actually fine to call this with queries/state that already exists\n // in the cache, or is older. hydrate() is idempotent for queries.\n // eslint-disable-next-line react-hooks/refs\n hydrate(client, { queries: newQueries }, optionsRef.current)\n }\n if (existingQueries.length > 0) {\n return existingQueries\n }\n }\n return undefined\n }, [client, state])\n\n React.useEffect(() => {\n if (hydrationQueue) {\n hydrate(client, { queries: hydrationQueue }, optionsRef.current)\n }\n }, [client, hydrationQueue])\n\n return children as React.ReactElement\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AAEvB,wBAAwB;AACxB,iCAA+B;AAoBxB,IAAM,oBAAoB,CAAC;AAAA,EAChC;AAAA,EACA,UAAU,CAAC;AAAA,EACX;AAAA,EACA;AACF,MAA8B;AAC5B,QAAM,aAAS,2CAAe,WAAW;AAEzC,QAAM,aAAmB,aAAO,OAAO;AACvC,EAAM,gBAAU,MAAM;AACpB,eAAW,UAAU;AAAA,EACvB,CAAC;AAiBD,QAAM,iBACE,cAAQ,MAAM;AAClB,QAAI,OAAO;AACT,UAAI,OAAO,UAAU,UAAU;AAC7B;AAAA,MACF;AAEA,YAAM,aAAa,OAAO,cAAc;AAKxC,YAAM,UAAU,MAAM,WAAW,CAAC;AAElC,YAAM,aAAyC,CAAC;AAChD,YAAM,kBAA8C,CAAC;AACrD,iBAAW,mBAAmB,SAAS;AACrC,cAAM,gBAAgB,WAAW,IAAI,gBAAgB,SAAS;AAE9D,YAAI,CAAC,eAAe;AAClB,qBAAW,KAAK,eAAe;AAAA,QACjC,OAAO;AACL,gBAAM,mBACJ,gBAAgB,MAAM,gBACpB,cAAc,MAAM,iBACrB,gBAAgB,WACf,cAAc,MAAM,WAAW,aAC/B,cAAc,MAAM,gBAAgB,cACpC,gBAAgB,iBAAiB,UACjC,gBAAgB,eACd,cAAc,MAAM;AAE1B,cAAI,kBAAkB;AACpB,4BAAgB,KAAK,eAAe;AAAA,UACtC;AAAA,QACF;AAAA,MACF;AAEA,UAAI,WAAW,SAAS,GAAG;AAIzB,uCAAQ,QAAQ,EAAE,SAAS,WAAW,GAAG,WAAW,OAAO;AAAA,MAC7D;AACA,UAAI,gBAAgB,SAAS,GAAG;AAC9B,eAAO;AAAA,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT,GAAG,CAAC,QAAQ,KAAK,CAAC;AAEpB,EAAM,gBAAU,MAAM;AACpB,QAAI,gBAAgB;AAClB,qCAAQ,QAAQ,EAAE,SAAS,eAAe,GAAG,WAAW,OAAO;AAAA,IACjE;AAAA,EACF,GAAG,CAAC,QAAQ,cAAc,CAAC;AAE3B,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/HydrationBoundary.tsx
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { hydrate } from "@tanstack/query-core";
|
|
6
|
+
import { useQueryClient } from "./QueryClientProvider.js";
|
|
7
|
+
var HydrationBoundary = ({
|
|
8
|
+
children,
|
|
9
|
+
options = {},
|
|
10
|
+
state,
|
|
11
|
+
queryClient
|
|
12
|
+
}) => {
|
|
13
|
+
const client = useQueryClient(queryClient);
|
|
14
|
+
const optionsRef = React.useRef(options);
|
|
15
|
+
React.useEffect(() => {
|
|
16
|
+
optionsRef.current = options;
|
|
17
|
+
});
|
|
18
|
+
const hydrationQueue = React.useMemo(() => {
|
|
19
|
+
if (state) {
|
|
20
|
+
if (typeof state !== "object") {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const queryCache = client.getQueryCache();
|
|
24
|
+
const queries = state.queries || [];
|
|
25
|
+
const newQueries = [];
|
|
26
|
+
const existingQueries = [];
|
|
27
|
+
for (const dehydratedQuery of queries) {
|
|
28
|
+
const existingQuery = queryCache.get(dehydratedQuery.queryHash);
|
|
29
|
+
if (!existingQuery) {
|
|
30
|
+
newQueries.push(dehydratedQuery);
|
|
31
|
+
} else {
|
|
32
|
+
const hydrationIsNewer = dehydratedQuery.state.dataUpdatedAt > existingQuery.state.dataUpdatedAt || dehydratedQuery.promise && existingQuery.state.status !== "pending" && existingQuery.state.fetchStatus !== "fetching" && dehydratedQuery.dehydratedAt !== void 0 && dehydratedQuery.dehydratedAt > existingQuery.state.dataUpdatedAt;
|
|
33
|
+
if (hydrationIsNewer) {
|
|
34
|
+
existingQueries.push(dehydratedQuery);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (newQueries.length > 0) {
|
|
39
|
+
hydrate(client, { queries: newQueries }, optionsRef.current);
|
|
40
|
+
}
|
|
41
|
+
if (existingQueries.length > 0) {
|
|
42
|
+
return existingQueries;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return void 0;
|
|
46
|
+
}, [client, state]);
|
|
47
|
+
React.useEffect(() => {
|
|
48
|
+
if (hydrationQueue) {
|
|
49
|
+
hydrate(client, { queries: hydrationQueue }, optionsRef.current);
|
|
50
|
+
}
|
|
51
|
+
}, [client, hydrationQueue]);
|
|
52
|
+
return children;
|
|
53
|
+
};
|
|
54
|
+
export {
|
|
55
|
+
HydrationBoundary
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=HydrationBoundary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/HydrationBoundary.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport { hydrate } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type {\n DehydratedState,\n HydrateOptions,\n OmitKeyof,\n QueryClient,\n} from '@tanstack/query-core'\n\nexport interface HydrationBoundaryProps {\n state: DehydratedState | null | undefined\n options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & {\n defaultOptions?: OmitKeyof<\n Exclude<HydrateOptions['defaultOptions'], undefined>,\n 'mutations'\n >\n }\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 React.useEffect(() => {\n optionsRef.current = options\n })\n\n // This useMemo is for performance reasons only, everything inside it must\n // be safe to run in every render and code here should be read as \"in render\".\n //\n // This code needs to happen during the render phase, because after initial\n // SSR, hydration needs to happen _before_ children render. Also, if hydrating\n // during a transition, we want to hydrate as much as is safe in render so\n // we can prerender as much as possible.\n //\n // For any queries that already exist in the cache, we want to hold back on\n // hydrating until _after_ the render phase. The reason for this is that during\n // transitions, we don't want the existing queries and observers to update to\n // the new data on the current page, only _after_ the transition is committed.\n // If the transition is aborted, we will have hydrated any _new_ queries, but\n // we throw away the fresh data for any existing ones to avoid unexpectedly\n // updating the UI.\n const hydrationQueue: DehydratedState['queries'] | undefined =\n React.useMemo(() => {\n if (state) {\n if (typeof state !== 'object') {\n return\n }\n\n const queryCache = client.getQueryCache()\n // State is supplied from the outside and we might as well fail\n // gracefully if it has the wrong shape, so while we type `queries`\n // as required, we still provide a fallback.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const queries = state.queries || []\n\n const newQueries: DehydratedState['queries'] = []\n const existingQueries: DehydratedState['queries'] = []\n for (const dehydratedQuery of queries) {\n const existingQuery = queryCache.get(dehydratedQuery.queryHash)\n\n if (!existingQuery) {\n newQueries.push(dehydratedQuery)\n } else {\n const hydrationIsNewer =\n dehydratedQuery.state.dataUpdatedAt >\n existingQuery.state.dataUpdatedAt ||\n (dehydratedQuery.promise &&\n existingQuery.state.status !== 'pending' &&\n existingQuery.state.fetchStatus !== 'fetching' &&\n dehydratedQuery.dehydratedAt !== undefined &&\n dehydratedQuery.dehydratedAt >\n existingQuery.state.dataUpdatedAt)\n\n if (hydrationIsNewer) {\n existingQueries.push(dehydratedQuery)\n }\n }\n }\n\n if (newQueries.length > 0) {\n // It's actually fine to call this with queries/state that already exists\n // in the cache, or is older. hydrate() is idempotent for queries.\n // eslint-disable-next-line react-hooks/refs\n hydrate(client, { queries: newQueries }, optionsRef.current)\n }\n if (existingQueries.length > 0) {\n return existingQueries\n }\n }\n return undefined\n }, [client, state])\n\n React.useEffect(() => {\n if (hydrationQueue) {\n hydrate(client, { queries: hydrationQueue }, optionsRef.current)\n }\n }, [client, hydrationQueue])\n\n return children as React.ReactElement\n}\n"],"mappings":";;;AACA,YAAY,WAAW;AAEvB,SAAS,eAAe;AACxB,SAAS,sBAAsB;AAoBxB,IAAM,oBAAoB,CAAC;AAAA,EAChC;AAAA,EACA,UAAU,CAAC;AAAA,EACX;AAAA,EACA;AACF,MAA8B;AAC5B,QAAM,SAAS,eAAe,WAAW;AAEzC,QAAM,aAAmB,aAAO,OAAO;AACvC,EAAM,gBAAU,MAAM;AACpB,eAAW,UAAU;AAAA,EACvB,CAAC;AAiBD,QAAM,iBACE,cAAQ,MAAM;AAClB,QAAI,OAAO;AACT,UAAI,OAAO,UAAU,UAAU;AAC7B;AAAA,MACF;AAEA,YAAM,aAAa,OAAO,cAAc;AAKxC,YAAM,UAAU,MAAM,WAAW,CAAC;AAElC,YAAM,aAAyC,CAAC;AAChD,YAAM,kBAA8C,CAAC;AACrD,iBAAW,mBAAmB,SAAS;AACrC,cAAM,gBAAgB,WAAW,IAAI,gBAAgB,SAAS;AAE9D,YAAI,CAAC,eAAe;AAClB,qBAAW,KAAK,eAAe;AAAA,QACjC,OAAO;AACL,gBAAM,mBACJ,gBAAgB,MAAM,gBACpB,cAAc,MAAM,iBACrB,gBAAgB,WACf,cAAc,MAAM,WAAW,aAC/B,cAAc,MAAM,gBAAgB,cACpC,gBAAgB,iBAAiB,UACjC,gBAAgB,eACd,cAAc,MAAM;AAE1B,cAAI,kBAAkB;AACpB,4BAAgB,KAAK,eAAe;AAAA,UACtC;AAAA,QACF;AAAA,MACF;AAEA,UAAI,WAAW,SAAS,GAAG;AAIzB,gBAAQ,QAAQ,EAAE,SAAS,WAAW,GAAG,WAAW,OAAO;AAAA,MAC7D;AACA,UAAI,gBAAgB,SAAS,GAAG;AAC9B,eAAO;AAAA,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT,GAAG,CAAC,QAAQ,KAAK,CAAC;AAEpB,EAAM,gBAAU,MAAM;AACpB,QAAI,gBAAgB;AAClB,cAAQ,QAAQ,EAAE,SAAS,eAAe,GAAG,WAAW,OAAO;AAAA,IACjE;AAAA,EACF,GAAG,CAAC,QAAQ,cAAc,CAAC;AAE3B,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/IsRestoringProvider.ts
|
|
32
|
+
var IsRestoringProvider_exports = {};
|
|
33
|
+
__export(IsRestoringProvider_exports, {
|
|
34
|
+
IsRestoringProvider: () => IsRestoringProvider,
|
|
35
|
+
useIsRestoring: () => useIsRestoring
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(IsRestoringProvider_exports);
|
|
38
|
+
var React = __toESM(require("react"), 1);
|
|
39
|
+
var IsRestoringContext = React.createContext(false);
|
|
40
|
+
var useIsRestoring = () => React.useContext(IsRestoringContext);
|
|
41
|
+
var IsRestoringProvider = IsRestoringContext.Provider;
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
IsRestoringProvider,
|
|
45
|
+
useIsRestoring
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=IsRestoringProvider.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/IsRestoringProvider.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nconst IsRestoringContext = React.createContext(false)\n\nexport const useIsRestoring = () => React.useContext(IsRestoringContext)\nexport const IsRestoringProvider = IsRestoringContext.Provider\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AAEvB,IAAM,qBAA2B,oBAAc,KAAK;AAE7C,IAAM,iBAAiB,MAAY,iBAAW,kBAAkB;AAChE,IAAM,sBAAsB,mBAAmB;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/IsRestoringProvider.ts
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
var IsRestoringContext = React.createContext(false);
|
|
6
|
+
var useIsRestoring = () => React.useContext(IsRestoringContext);
|
|
7
|
+
var IsRestoringProvider = IsRestoringContext.Provider;
|
|
8
|
+
export {
|
|
9
|
+
IsRestoringProvider,
|
|
10
|
+
useIsRestoring
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=IsRestoringProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/IsRestoringProvider.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nconst IsRestoringContext = React.createContext(false)\n\nexport const useIsRestoring = () => React.useContext(IsRestoringContext)\nexport const IsRestoringProvider = IsRestoringContext.Provider\n"],"mappings":";;;AACA,YAAY,WAAW;AAEvB,IAAM,qBAA2B,oBAAc,KAAK;AAE7C,IAAM,iBAAiB,MAAY,iBAAW,kBAAkB;AAChE,IAAM,sBAAsB,mBAAmB;","names":[]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/QueryClientProvider.tsx
|
|
32
|
+
var QueryClientProvider_exports = {};
|
|
33
|
+
__export(QueryClientProvider_exports, {
|
|
34
|
+
QueryClientContext: () => QueryClientContext,
|
|
35
|
+
QueryClientProvider: () => QueryClientProvider,
|
|
36
|
+
useQueryClient: () => useQueryClient
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(QueryClientProvider_exports);
|
|
39
|
+
var React = __toESM(require("react"), 1);
|
|
40
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
41
|
+
var QueryClientContext = React.createContext(
|
|
42
|
+
void 0
|
|
43
|
+
);
|
|
44
|
+
var useQueryClient = (queryClient) => {
|
|
45
|
+
const client = React.useContext(QueryClientContext);
|
|
46
|
+
if (queryClient) {
|
|
47
|
+
return queryClient;
|
|
48
|
+
}
|
|
49
|
+
if (!client) {
|
|
50
|
+
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
51
|
+
}
|
|
52
|
+
return client;
|
|
53
|
+
};
|
|
54
|
+
var QueryClientProvider = ({
|
|
55
|
+
client,
|
|
56
|
+
children
|
|
57
|
+
}) => {
|
|
58
|
+
React.useEffect(() => {
|
|
59
|
+
client.mount();
|
|
60
|
+
return () => {
|
|
61
|
+
client.unmount();
|
|
62
|
+
};
|
|
63
|
+
}, [client]);
|
|
64
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QueryClientContext.Provider, { value: client, children });
|
|
65
|
+
};
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
QueryClientContext,
|
|
69
|
+
QueryClientProvider,
|
|
70
|
+
useQueryClient
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=QueryClientProvider.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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): React.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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AAuCnB;AAnCG,IAAM,qBAA2B;AAAA,EACtC;AACF;AAEO,IAAM,iBAAiB,CAAC,gBAA8B;AAC3D,QAAM,SAAe,iBAAW,kBAAkB;AAElD,MAAI,aAAa;AACf,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI,MAAM,wDAAwD;AAAA,EAC1E;AAEA,SAAO;AACT;AAOO,IAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA;AACF,MAAmD;AACjD,EAAM,gBAAU,MAAM;AACpB,WAAO,MAAM;AACb,WAAO,MAAM;AACX,aAAO,QAAQ;AAAA,IACjB;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AAEX,SACE,4CAAC,mBAAmB,UAAnB,EAA4B,OAAO,QACjC,UACH;AAEJ;","names":[]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/QueryClientProvider.tsx
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
var QueryClientContext = React.createContext(
|
|
7
|
+
void 0
|
|
8
|
+
);
|
|
9
|
+
var useQueryClient = (queryClient) => {
|
|
10
|
+
const client = React.useContext(QueryClientContext);
|
|
11
|
+
if (queryClient) {
|
|
12
|
+
return queryClient;
|
|
13
|
+
}
|
|
14
|
+
if (!client) {
|
|
15
|
+
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
16
|
+
}
|
|
17
|
+
return client;
|
|
18
|
+
};
|
|
19
|
+
var QueryClientProvider = ({
|
|
20
|
+
client,
|
|
21
|
+
children
|
|
22
|
+
}) => {
|
|
23
|
+
React.useEffect(() => {
|
|
24
|
+
client.mount();
|
|
25
|
+
return () => {
|
|
26
|
+
client.unmount();
|
|
27
|
+
};
|
|
28
|
+
}, [client]);
|
|
29
|
+
return /* @__PURE__ */ jsx(QueryClientContext.Provider, { value: client, children });
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
QueryClientContext,
|
|
33
|
+
QueryClientProvider,
|
|
34
|
+
useQueryClient
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=QueryClientProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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): React.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"],"mappings":";;;AACA,YAAY,WAAW;AAuCnB;AAnCG,IAAM,qBAA2B;AAAA,EACtC;AACF;AAEO,IAAM,iBAAiB,CAAC,gBAA8B;AAC3D,QAAM,SAAe,iBAAW,kBAAkB;AAElD,MAAI,aAAa;AACf,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI,MAAM,wDAAwD;AAAA,EAC1E;AAEA,SAAO;AACT;AAOO,IAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA;AACF,MAAmD;AACjD,EAAM,gBAAU,MAAM;AACpB,WAAO,MAAM;AACb,WAAO,MAAM;AACX,aAAO,QAAQ;AAAA,IACjB;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AAEX,SACE,oBAAC,mBAAmB,UAAnB,EAA4B,OAAO,QACjC,UACH;AAEJ;","names":[]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/QueryErrorResetBoundary.tsx
|
|
32
|
+
var QueryErrorResetBoundary_exports = {};
|
|
33
|
+
__export(QueryErrorResetBoundary_exports, {
|
|
34
|
+
QueryErrorResetBoundary: () => QueryErrorResetBoundary,
|
|
35
|
+
useQueryErrorResetBoundary: () => useQueryErrorResetBoundary
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(QueryErrorResetBoundary_exports);
|
|
38
|
+
var React = __toESM(require("react"), 1);
|
|
39
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
40
|
+
function createValue() {
|
|
41
|
+
let isReset = false;
|
|
42
|
+
return {
|
|
43
|
+
clearReset: () => {
|
|
44
|
+
isReset = false;
|
|
45
|
+
},
|
|
46
|
+
reset: () => {
|
|
47
|
+
isReset = true;
|
|
48
|
+
},
|
|
49
|
+
isReset: () => {
|
|
50
|
+
return isReset;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
var QueryErrorResetBoundaryContext = React.createContext(createValue());
|
|
55
|
+
var useQueryErrorResetBoundary = () => React.useContext(QueryErrorResetBoundaryContext);
|
|
56
|
+
var QueryErrorResetBoundary = ({
|
|
57
|
+
children
|
|
58
|
+
}) => {
|
|
59
|
+
const [value] = React.useState(() => createValue());
|
|
60
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QueryErrorResetBoundaryContext.Provider, { value, children: typeof children === "function" ? children(value) : children });
|
|
61
|
+
};
|
|
62
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
+
0 && (module.exports = {
|
|
64
|
+
QueryErrorResetBoundary,
|
|
65
|
+
useQueryErrorResetBoundary
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=QueryErrorResetBoundary.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/QueryErrorResetBoundary.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\n// CONTEXT\nexport type QueryErrorResetFunction = () => void\nexport type QueryErrorIsResetFunction = () => boolean\nexport type QueryErrorClearResetFunction = () => void\n\nexport interface QueryErrorResetBoundaryValue {\n clearReset: QueryErrorClearResetFunction\n isReset: QueryErrorIsResetFunction\n reset: QueryErrorResetFunction\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 type QueryErrorResetBoundaryFunction = (\n value: QueryErrorResetBoundaryValue,\n) => React.ReactNode\n\nexport interface QueryErrorResetBoundaryProps {\n children: QueryErrorResetBoundaryFunction | 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' ? children(value) : children}\n </QueryErrorResetBoundaryContext.Provider>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AAkDnB;AArCJ,SAAS,cAA4C;AACnD,MAAI,UAAU;AACd,SAAO;AAAA,IACL,YAAY,MAAM;AAChB,gBAAU;AAAA,IACZ;AAAA,IACA,OAAO,MAAM;AACX,gBAAU;AAAA,IACZ;AAAA,IACA,SAAS,MAAM;AACb,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAEA,IAAM,iCAAuC,oBAAc,YAAY,CAAC;AAIjE,IAAM,6BAA6B,MAClC,iBAAW,8BAA8B;AAY1C,IAAM,0BAA0B,CAAC;AAAA,EACtC;AACF,MAAoC;AAClC,QAAM,CAAC,KAAK,IAAU,eAAS,MAAM,YAAY,CAAC;AAClD,SACE,4CAAC,+BAA+B,UAA/B,EAAwC,OACtC,iBAAO,aAAa,aAAa,SAAS,KAAK,IAAI,UACtD;AAEJ;","names":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { QueryErrorResetFunction } from './_tsup-dts-rollup.cjs';
|
|
2
|
+
export { QueryErrorIsResetFunction } from './_tsup-dts-rollup.cjs';
|
|
3
|
+
export { QueryErrorClearResetFunction } from './_tsup-dts-rollup.cjs';
|
|
4
|
+
export { QueryErrorResetBoundaryValue } from './_tsup-dts-rollup.cjs';
|
|
5
|
+
export { useQueryErrorResetBoundary } from './_tsup-dts-rollup.cjs';
|
|
6
|
+
export { QueryErrorResetBoundaryFunction } from './_tsup-dts-rollup.cjs';
|
|
7
|
+
export { QueryErrorResetBoundaryProps } from './_tsup-dts-rollup.cjs';
|
|
8
|
+
export { QueryErrorResetBoundary } from './_tsup-dts-rollup.cjs';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { QueryErrorResetFunction } from './_tsup-dts-rollup.js';
|
|
2
|
+
export { QueryErrorIsResetFunction } from './_tsup-dts-rollup.js';
|
|
3
|
+
export { QueryErrorClearResetFunction } from './_tsup-dts-rollup.js';
|
|
4
|
+
export { QueryErrorResetBoundaryValue } from './_tsup-dts-rollup.js';
|
|
5
|
+
export { useQueryErrorResetBoundary } from './_tsup-dts-rollup.js';
|
|
6
|
+
export { QueryErrorResetBoundaryFunction } from './_tsup-dts-rollup.js';
|
|
7
|
+
export { QueryErrorResetBoundaryProps } from './_tsup-dts-rollup.js';
|
|
8
|
+
export { QueryErrorResetBoundary } from './_tsup-dts-rollup.js';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/QueryErrorResetBoundary.tsx
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
function createValue() {
|
|
7
|
+
let isReset = false;
|
|
8
|
+
return {
|
|
9
|
+
clearReset: () => {
|
|
10
|
+
isReset = false;
|
|
11
|
+
},
|
|
12
|
+
reset: () => {
|
|
13
|
+
isReset = true;
|
|
14
|
+
},
|
|
15
|
+
isReset: () => {
|
|
16
|
+
return isReset;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
var QueryErrorResetBoundaryContext = React.createContext(createValue());
|
|
21
|
+
var useQueryErrorResetBoundary = () => React.useContext(QueryErrorResetBoundaryContext);
|
|
22
|
+
var QueryErrorResetBoundary = ({
|
|
23
|
+
children
|
|
24
|
+
}) => {
|
|
25
|
+
const [value] = React.useState(() => createValue());
|
|
26
|
+
return /* @__PURE__ */ jsx(QueryErrorResetBoundaryContext.Provider, { value, children: typeof children === "function" ? children(value) : children });
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
QueryErrorResetBoundary,
|
|
30
|
+
useQueryErrorResetBoundary
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=QueryErrorResetBoundary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/QueryErrorResetBoundary.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\n// CONTEXT\nexport type QueryErrorResetFunction = () => void\nexport type QueryErrorIsResetFunction = () => boolean\nexport type QueryErrorClearResetFunction = () => void\n\nexport interface QueryErrorResetBoundaryValue {\n clearReset: QueryErrorClearResetFunction\n isReset: QueryErrorIsResetFunction\n reset: QueryErrorResetFunction\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 type QueryErrorResetBoundaryFunction = (\n value: QueryErrorResetBoundaryValue,\n) => React.ReactNode\n\nexport interface QueryErrorResetBoundaryProps {\n children: QueryErrorResetBoundaryFunction | 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' ? children(value) : children}\n </QueryErrorResetBoundaryContext.Provider>\n )\n}\n"],"mappings":";;;AACA,YAAY,WAAW;AAkDnB;AArCJ,SAAS,cAA4C;AACnD,MAAI,UAAU;AACd,SAAO;AAAA,IACL,YAAY,MAAM;AAChB,gBAAU;AAAA,IACZ;AAAA,IACA,OAAO,MAAM;AACX,gBAAU;AAAA,IACZ;AAAA,IACA,SAAS,MAAM;AACb,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAEA,IAAM,iCAAuC,oBAAc,YAAY,CAAC;AAIjE,IAAM,6BAA6B,MAClC,iBAAW,8BAA8B;AAY1C,IAAM,0BAA0B,CAAC;AAAA,EACtC;AACF,MAAoC;AAClC,QAAM,CAAC,KAAK,IAAU,eAAS,MAAM,YAAY,CAAC;AAClD,SACE,oBAAC,+BAA+B,UAA/B,EAAwC,OACtC,iBAAO,aAAa,aAAa,SAAS,KAAK,IAAI,UACtD;AAEJ;","names":[]}
|