@tanstack/preact-query 0.0.1 → 5.91.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 +48 -45
- 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 +80 -0
- package/build/legacy/HydrationBoundary.cjs.map +1 -0
- package/build/legacy/HydrationBoundary.d.cts +14 -0
- package/build/legacy/HydrationBoundary.d.ts +14 -0
- package/build/legacy/HydrationBoundary.js +55 -0
- package/build/legacy/HydrationBoundary.js.map +1 -0
- package/build/legacy/IsRestoringProvider.cjs +37 -0
- package/build/legacy/IsRestoringProvider.cjs.map +1 -0
- package/build/legacy/IsRestoringProvider.d.cts +6 -0
- package/build/legacy/IsRestoringProvider.d.ts +6 -0
- package/build/legacy/IsRestoringProvider.js +11 -0
- package/build/legacy/IsRestoringProvider.js.map +1 -0
- package/build/legacy/QueryClientProvider.cjs +62 -0
- package/build/legacy/QueryClientProvider.cjs.map +1 -0
- package/build/legacy/QueryClientProvider.d.cts +13 -0
- package/build/legacy/QueryClientProvider.d.ts +13 -0
- package/build/legacy/QueryClientProvider.js +35 -0
- package/build/legacy/QueryClientProvider.js.map +1 -0
- package/build/legacy/QueryErrorResetBoundary.cjs +57 -0
- package/build/legacy/QueryErrorResetBoundary.cjs.map +1 -0
- package/build/legacy/QueryErrorResetBoundary.d.cts +19 -0
- package/build/legacy/QueryErrorResetBoundary.d.ts +19 -0
- package/build/legacy/QueryErrorResetBoundary.js +31 -0
- package/build/legacy/QueryErrorResetBoundary.js.map +1 -0
- package/build/legacy/errorBoundaryUtils.cjs +57 -0
- package/build/legacy/errorBoundaryUtils.cjs.map +1 -0
- package/build/legacy/errorBoundaryUtils.d.cts +15 -0
- package/build/legacy/errorBoundaryUtils.d.ts +15 -0
- package/build/legacy/errorBoundaryUtils.js +30 -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 +21 -0
- package/build/legacy/index.d.ts +21 -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 +23 -0
- package/build/legacy/infiniteQueryOptions.d.ts +23 -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 +7 -0
- package/build/legacy/mutationOptions.d.ts +7 -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 +24 -0
- package/build/legacy/queryOptions.d.ts +24 -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 +11 -0
- package/build/legacy/suspense.d.ts +11 -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 +52 -0
- package/build/legacy/types.d.ts +52 -0
- package/build/legacy/types.js +1 -0
- package/build/legacy/types.js.map +1 -0
- package/build/legacy/useBaseQuery.cjs +121 -0
- package/build/legacy/useBaseQuery.cjs.map +1 -0
- package/build/legacy/useBaseQuery.d.cts +6 -0
- package/build/legacy/useBaseQuery.d.ts +6 -0
- package/build/legacy/useBaseQuery.js +105 -0
- package/build/legacy/useBaseQuery.js.map +1 -0
- package/build/legacy/useInfiniteQuery.cjs +39 -0
- package/build/legacy/useInfiniteQuery.cjs.map +1 -0
- package/build/legacy/useInfiniteQuery.d.cts +9 -0
- package/build/legacy/useInfiniteQuery.d.ts +9 -0
- package/build/legacy/useInfiniteQuery.js +14 -0
- package/build/legacy/useInfiniteQuery.js.map +1 -0
- package/build/legacy/useIsFetching.cjs +45 -0
- package/build/legacy/useIsFetching.cjs.map +1 -0
- package/build/legacy/useIsFetching.d.cts +5 -0
- package/build/legacy/useIsFetching.d.ts +5 -0
- package/build/legacy/useIsFetching.js +20 -0
- package/build/legacy/useIsFetching.js.map +1 -0
- package/build/legacy/useMutation.cjs +63 -0
- package/build/legacy/useMutation.cjs.map +1 -0
- package/build/legacy/useMutation.d.cts +6 -0
- package/build/legacy/useMutation.d.ts +6 -0
- package/build/legacy/useMutation.js +43 -0
- package/build/legacy/useMutation.js.map +1 -0
- package/build/legacy/useMutationState.cjs +75 -0
- package/build/legacy/useMutationState.cjs.map +1 -0
- package/build/legacy/useMutationState.d.cts +10 -0
- package/build/legacy/useMutationState.d.ts +10 -0
- package/build/legacy/useMutationState.js +49 -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 +5 -0
- package/build/legacy/usePrefetchInfiniteQuery.d.ts +5 -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 +6 -0
- package/build/legacy/usePrefetchQuery.d.ts +6 -0
- package/build/legacy/usePrefetchQuery.js +12 -0
- package/build/legacy/usePrefetchQuery.js.map +1 -0
- package/build/legacy/useQueries.cjs +120 -0
- package/build/legacy/useQueries.cjs.map +1 -0
- package/build/legacy/useQueries.d.cts +76 -0
- package/build/legacy/useQueries.d.ts +76 -0
- package/build/legacy/useQueries.js +109 -0
- package/build/legacy/useQueries.js.map +1 -0
- package/build/legacy/useQuery.cjs +35 -0
- package/build/legacy/useQuery.cjs.map +1 -0
- package/build/legacy/useQuery.d.cts +9 -0
- package/build/legacy/useQuery.d.ts +9 -0
- package/build/legacy/useQuery.js +10 -0
- package/build/legacy/useQuery.js.map +1 -0
- package/build/legacy/useSuspenseInfiniteQuery.cjs +50 -0
- package/build/legacy/useSuspenseInfiniteQuery.cjs.map +1 -0
- package/build/legacy/useSuspenseInfiniteQuery.d.cts +6 -0
- package/build/legacy/useSuspenseInfiniteQuery.d.ts +6 -0
- package/build/legacy/useSuspenseInfiniteQuery.js +25 -0
- package/build/legacy/useSuspenseInfiniteQuery.js.map +1 -0
- package/build/legacy/useSuspenseQueries.cjs +55 -0
- package/build/legacy/useSuspenseQueries.cjs.map +1 -0
- package/build/legacy/useSuspenseQueries.d.cts +79 -0
- package/build/legacy/useSuspenseQueries.d.ts +79 -0
- package/build/legacy/useSuspenseQueries.js +30 -0
- package/build/legacy/useSuspenseQueries.js.map +1 -0
- package/build/legacy/useSuspenseQuery.cjs +51 -0
- package/build/legacy/useSuspenseQuery.cjs.map +1 -0
- package/build/legacy/useSuspenseQuery.d.cts +6 -0
- package/build/legacy/useSuspenseQuery.d.ts +6 -0
- package/build/legacy/useSuspenseQuery.js +26 -0
- package/build/legacy/useSuspenseQuery.js.map +1 -0
- package/build/legacy/utils.cjs +79 -0
- package/build/legacy/utils.cjs.map +1 -0
- package/build/legacy/utils.d.cts +4 -0
- package/build/legacy/utils.d.ts +4 -0
- package/build/legacy/utils.js +53 -0
- package/build/legacy/utils.js.map +1 -0
- package/build/modern/HydrationBoundary.cjs +80 -0
- package/build/modern/HydrationBoundary.cjs.map +1 -0
- package/build/modern/HydrationBoundary.d.cts +14 -0
- package/build/modern/HydrationBoundary.d.ts +14 -0
- package/build/modern/HydrationBoundary.js +55 -0
- package/build/modern/HydrationBoundary.js.map +1 -0
- package/build/modern/IsRestoringProvider.cjs +37 -0
- package/build/modern/IsRestoringProvider.cjs.map +1 -0
- package/build/modern/IsRestoringProvider.d.cts +6 -0
- package/build/modern/IsRestoringProvider.d.ts +6 -0
- package/build/modern/IsRestoringProvider.js +11 -0
- package/build/modern/IsRestoringProvider.js.map +1 -0
- package/build/modern/QueryClientProvider.cjs +62 -0
- package/build/modern/QueryClientProvider.cjs.map +1 -0
- package/build/modern/QueryClientProvider.d.cts +13 -0
- package/build/modern/QueryClientProvider.d.ts +13 -0
- package/build/modern/QueryClientProvider.js +35 -0
- package/build/modern/QueryClientProvider.js.map +1 -0
- package/build/modern/QueryErrorResetBoundary.cjs +57 -0
- package/build/modern/QueryErrorResetBoundary.cjs.map +1 -0
- package/build/modern/QueryErrorResetBoundary.d.cts +19 -0
- package/build/modern/QueryErrorResetBoundary.d.ts +19 -0
- package/build/modern/QueryErrorResetBoundary.js +31 -0
- package/build/modern/QueryErrorResetBoundary.js.map +1 -0
- package/build/modern/errorBoundaryUtils.cjs +57 -0
- package/build/modern/errorBoundaryUtils.cjs.map +1 -0
- package/build/modern/errorBoundaryUtils.d.cts +15 -0
- package/build/modern/errorBoundaryUtils.d.ts +15 -0
- package/build/modern/errorBoundaryUtils.js +30 -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 +21 -0
- package/build/modern/index.d.ts +21 -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 +23 -0
- package/build/modern/infiniteQueryOptions.d.ts +23 -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 +7 -0
- package/build/modern/mutationOptions.d.ts +7 -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 +24 -0
- package/build/modern/queryOptions.d.ts +24 -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 +11 -0
- package/build/modern/suspense.d.ts +11 -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 +52 -0
- package/build/modern/types.d.ts +52 -0
- package/build/modern/types.js +1 -0
- package/build/modern/types.js.map +1 -0
- package/build/modern/useBaseQuery.cjs +118 -0
- package/build/modern/useBaseQuery.cjs.map +1 -0
- package/build/modern/useBaseQuery.d.cts +6 -0
- package/build/modern/useBaseQuery.d.ts +6 -0
- package/build/modern/useBaseQuery.js +102 -0
- package/build/modern/useBaseQuery.js.map +1 -0
- package/build/modern/useInfiniteQuery.cjs +39 -0
- package/build/modern/useInfiniteQuery.cjs.map +1 -0
- package/build/modern/useInfiniteQuery.d.cts +9 -0
- package/build/modern/useInfiniteQuery.d.ts +9 -0
- package/build/modern/useInfiniteQuery.js +14 -0
- package/build/modern/useInfiniteQuery.js.map +1 -0
- package/build/modern/useIsFetching.cjs +45 -0
- package/build/modern/useIsFetching.cjs.map +1 -0
- package/build/modern/useIsFetching.d.cts +5 -0
- package/build/modern/useIsFetching.d.ts +5 -0
- package/build/modern/useIsFetching.js +20 -0
- package/build/modern/useIsFetching.js.map +1 -0
- package/build/modern/useMutation.cjs +63 -0
- package/build/modern/useMutation.cjs.map +1 -0
- package/build/modern/useMutation.d.cts +6 -0
- package/build/modern/useMutation.d.ts +6 -0
- package/build/modern/useMutation.js +43 -0
- package/build/modern/useMutation.js.map +1 -0
- package/build/modern/useMutationState.cjs +75 -0
- package/build/modern/useMutationState.cjs.map +1 -0
- package/build/modern/useMutationState.d.cts +10 -0
- package/build/modern/useMutationState.d.ts +10 -0
- package/build/modern/useMutationState.js +49 -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 +5 -0
- package/build/modern/usePrefetchInfiniteQuery.d.ts +5 -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 +6 -0
- package/build/modern/usePrefetchQuery.d.ts +6 -0
- package/build/modern/usePrefetchQuery.js +12 -0
- package/build/modern/usePrefetchQuery.js.map +1 -0
- package/build/modern/useQueries.cjs +120 -0
- package/build/modern/useQueries.cjs.map +1 -0
- package/build/modern/useQueries.d.cts +76 -0
- package/build/modern/useQueries.d.ts +76 -0
- package/build/modern/useQueries.js +109 -0
- package/build/modern/useQueries.js.map +1 -0
- package/build/modern/useQuery.cjs +35 -0
- package/build/modern/useQuery.cjs.map +1 -0
- package/build/modern/useQuery.d.cts +9 -0
- package/build/modern/useQuery.d.ts +9 -0
- package/build/modern/useQuery.js +10 -0
- package/build/modern/useQuery.js.map +1 -0
- package/build/modern/useSuspenseInfiniteQuery.cjs +50 -0
- package/build/modern/useSuspenseInfiniteQuery.cjs.map +1 -0
- package/build/modern/useSuspenseInfiniteQuery.d.cts +6 -0
- package/build/modern/useSuspenseInfiniteQuery.d.ts +6 -0
- package/build/modern/useSuspenseInfiniteQuery.js +25 -0
- package/build/modern/useSuspenseInfiniteQuery.js.map +1 -0
- package/build/modern/useSuspenseQueries.cjs +55 -0
- package/build/modern/useSuspenseQueries.cjs.map +1 -0
- package/build/modern/useSuspenseQueries.d.cts +79 -0
- package/build/modern/useSuspenseQueries.d.ts +79 -0
- package/build/modern/useSuspenseQueries.js +30 -0
- package/build/modern/useSuspenseQueries.js.map +1 -0
- package/build/modern/useSuspenseQuery.cjs +51 -0
- package/build/modern/useSuspenseQuery.cjs.map +1 -0
- package/build/modern/useSuspenseQuery.d.cts +6 -0
- package/build/modern/useSuspenseQuery.d.ts +6 -0
- package/build/modern/useSuspenseQuery.js +26 -0
- package/build/modern/useSuspenseQuery.js.map +1 -0
- package/build/modern/utils.cjs +79 -0
- package/build/modern/utils.cjs.map +1 -0
- package/build/modern/utils.d.cts +4 -0
- package/build/modern/utils.d.ts +4 -0
- package/build/modern/utils.js +53 -0
- package/build/modern/utils.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/package.json +82 -8
- package/src/HydrationBoundary.tsx +108 -0
- package/src/IsRestoringProvider.ts +7 -0
- package/src/QueryClientProvider.tsx +45 -0
- package/src/QueryErrorResetBoundary.tsx +57 -0
- package/src/errorBoundaryUtils.ts +76 -0
- package/src/index.ts +56 -0
- package/src/infiniteQueryOptions.ts +150 -0
- package/src/mutationOptions.ts +42 -0
- package/src/queryOptions.ts +88 -0
- package/src/suspense.ts +81 -0
- package/src/types.ts +241 -0
- package/src/useBaseQuery.ts +169 -0
- package/src/useInfiniteQuery.ts +81 -0
- package/src/useIsFetching.ts +23 -0
- package/src/useMutation.ts +69 -0
- package/src/useMutationState.ts +74 -0
- package/src/usePrefetchInfiniteQuery.tsx +31 -0
- package/src/usePrefetchQuery.tsx +20 -0
- package/src/useQueries.ts +331 -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
- package/src/utils.ts +88 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021-present Tanner Linsley
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,45 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
1
|
+
<img src="https://static.scarf.sh/a.png?x-pxid=be2d8a11-9712-4c1d-9963-580b2d4fb133" />
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
Hooks for fetching, caching and updating asynchronous data in Preact
|
|
6
|
+
|
|
7
|
+
<a href="https://twitter.com/intent/tweet?button_hashtag=TanStack" target="\_parent">
|
|
8
|
+
<img alt="#TanStack" src="https://img.shields.io/twitter/url?color=%2308a0e9&label=%23TanStack&style=social&url=https%3A%2F%2Ftwitter.com%2Fintent%2Ftweet%3Fbutton_hashtag%3DTanStack">
|
|
9
|
+
</a><a href="https://discord.com/invite/WrRKjPJ" target="\_parent">
|
|
10
|
+
<img alt="" src="https://img.shields.io/badge/Discord-TanStack-%235865F2" />
|
|
11
|
+
</a><a href="https://github.com/TanStack/query/actions?query=workflow%3A%22preact-query+tests%22">
|
|
12
|
+
<img src="https://github.com/TanStack/query/workflows/preact-query%20tests/badge.svg" />
|
|
13
|
+
</a><a href="https://www.npmjs.com/package/@tanstack/query-core" target="\_parent">
|
|
14
|
+
<img alt="" src="https://img.shields.io/npm/dm/@tanstack/query-core.svg" />
|
|
15
|
+
</a><a href="https://bundlejs.com/?q=%40tanstack%2Fpreact-query&config=%7B%22esbuild%22%3A%7B%22external%22%3A%5B%22react%22%2C%22react-dom%22%5D%7D%7D&badge=" target="\_parent">
|
|
16
|
+
<img alt="" src="https://deno.bundlejs.com/?q=@tanstack/preact-query&config={%22esbuild%22:{%22external%22:[%22react%22,%22react-dom%22]}}&badge=detailed" />
|
|
17
|
+
</a><a href="#badge">
|
|
18
|
+
<img alt="semantic-release" src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg">
|
|
19
|
+
</a><a href="https://github.com/TanStack/query/discussions">
|
|
20
|
+
<img alt="Join the discussion on Github" src="https://img.shields.io/badge/Github%20Discussions%20%26%20Support-Chat%20now!-blue" />
|
|
21
|
+
</a><a href="https://bestofjs.org/projects/tanstack-query"><img alt="Best of JS" src="https://img.shields.io/endpoint?url=https://bestofjs-serverless.now.sh/api/project-badge?fullName=TanStack%2Fquery%26since=daily" /></a><a href="https://github.com/TanStack/query/" target="\_parent">
|
|
22
|
+
<img alt="" src="https://img.shields.io/github/stars/TanStack/query.svg?style=social&label=Star" />
|
|
23
|
+
</a><a href="https://twitter.com/tannerlinsley" target="\_parent">
|
|
24
|
+
<img alt="" src="https://img.shields.io/twitter/follow/tannerlinsley.svg?style=social&label=Follow" />
|
|
25
|
+
</a> <a href="https://gitpod.io/from-referrer/">
|
|
26
|
+
<img src="https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod" alt="Gitpod Ready-to-Code"/>
|
|
27
|
+
</a>
|
|
28
|
+
|
|
29
|
+
Enjoy this library? Try the entire [TanStack](https://tanstack.com)! [TanStack Table](https://github.com/TanStack/table), [TanStack Router](https://github.com/tanstack/router), [TanStack Virtual](https://github.com/tanstack/virtual), [React Charts](https://github.com/TanStack/react-charts), [React Ranger](https://github.com/TanStack/ranger)
|
|
30
|
+
|
|
31
|
+
## Visit [tanstack.com/query](https://tanstack.com/query) for docs, guides, API and more!
|
|
32
|
+
|
|
33
|
+
## Quick Features
|
|
34
|
+
|
|
35
|
+
- Transport/protocol/backend agnostic data fetching (REST, GraphQL, promises, whatever!)
|
|
36
|
+
- Auto Caching + Refetching (stale-while-revalidate, Window Refocus, Polling/Realtime)
|
|
37
|
+
- Parallel + Dependent Queries
|
|
38
|
+
- Mutations + Reactive Query Refetching
|
|
39
|
+
- Multi-layer Cache + Automatic Garbage Collection
|
|
40
|
+
- Paginated + Cursor-based Queries
|
|
41
|
+
- Load-More + Infinite Scroll Queries w/ Scroll Recovery
|
|
42
|
+
- Request Cancellation
|
|
43
|
+
- [Preact Suspense](https://preactjs.com/guide/v10/api-reference/#suspense) + Fetch-As-You-Render Query Prefetching -- Though not recommended because of the bulk preact/compat adds
|
|
44
|
+
- Dedicated Devtools
|
|
45
|
+
|
|
46
|
+
### [Become a Sponsor!](https://github.com/sponsors/tannerlinsley/)
|
|
47
|
+
|
|
48
|
+
<!-- Use the force, Luke -->
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
module.exports = ({ root, jscodeshift }) => {
|
|
2
|
+
const findImportIdentifierOf = (importSpecifiers, identifier) => {
|
|
3
|
+
const specifier = importSpecifiers
|
|
4
|
+
.filter((node) => node.value.imported.name === identifier)
|
|
5
|
+
.paths()
|
|
6
|
+
|
|
7
|
+
if (specifier.length > 0) {
|
|
8
|
+
return specifier[0].value.local
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return jscodeshift.identifier(identifier)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const findImportSpecifiers = (packageName) =>
|
|
15
|
+
root
|
|
16
|
+
.find(jscodeshift.ImportDeclaration, {
|
|
17
|
+
source: {
|
|
18
|
+
value: packageName,
|
|
19
|
+
},
|
|
20
|
+
})
|
|
21
|
+
.find(jscodeshift.ImportSpecifier, {})
|
|
22
|
+
|
|
23
|
+
const locateImports = (
|
|
24
|
+
identifiers,
|
|
25
|
+
packageName = '@tanstack/react-query',
|
|
26
|
+
) => {
|
|
27
|
+
const findNamespaceImportIdentifier = () => {
|
|
28
|
+
const specifier = root
|
|
29
|
+
.find(jscodeshift.ImportDeclaration, {
|
|
30
|
+
source: {
|
|
31
|
+
value: packageName,
|
|
32
|
+
},
|
|
33
|
+
})
|
|
34
|
+
.find(jscodeshift.ImportNamespaceSpecifier)
|
|
35
|
+
.paths()
|
|
36
|
+
|
|
37
|
+
return specifier.length > 0 ? specifier[0].value.local : null
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* First, we search for the namespace import identifier because if we have any, we assume the consumer uses
|
|
42
|
+
* namespace imports. In this case, we won't search for named imports at all.
|
|
43
|
+
*/
|
|
44
|
+
const namespaceImportIdentifier = findNamespaceImportIdentifier()
|
|
45
|
+
|
|
46
|
+
if (namespaceImportIdentifier) {
|
|
47
|
+
const identifierMap = {}
|
|
48
|
+
|
|
49
|
+
for (const identifier of identifiers) {
|
|
50
|
+
identifierMap[identifier] = jscodeshift.identifier(identifier)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
namespace: namespaceImportIdentifier,
|
|
55
|
+
...identifierMap,
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const importSpecifiers = findImportSpecifiers(packageName)
|
|
60
|
+
const identifierMap = {}
|
|
61
|
+
|
|
62
|
+
for (const identifier of identifiers) {
|
|
63
|
+
identifierMap[identifier] = findImportIdentifierOf(
|
|
64
|
+
importSpecifiers,
|
|
65
|
+
identifier,
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
namespace: null,
|
|
71
|
+
...identifierMap,
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const findAllMethodCalls = () =>
|
|
76
|
+
root
|
|
77
|
+
// First, we need to find all method calls.
|
|
78
|
+
.find(jscodeshift.CallExpression, {
|
|
79
|
+
callee: {
|
|
80
|
+
type: jscodeshift.MemberExpression.name,
|
|
81
|
+
property: {
|
|
82
|
+
type: jscodeshift.Identifier.name,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
const findQueryClientIdentifiers = (importIdentifiers) =>
|
|
88
|
+
root
|
|
89
|
+
.find(jscodeshift.VariableDeclarator, {})
|
|
90
|
+
.filter((node) => {
|
|
91
|
+
if (node.value.init) {
|
|
92
|
+
const initializer = node.value.init
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
isClassInstantiationOf(
|
|
96
|
+
initializer,
|
|
97
|
+
getSelectorByImports(importIdentifiers, 'QueryClient'),
|
|
98
|
+
) ||
|
|
99
|
+
isFunctionCallOf(
|
|
100
|
+
initializer,
|
|
101
|
+
getSelectorByImports(importIdentifiers, 'useQueryClient'),
|
|
102
|
+
)
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return false
|
|
107
|
+
})
|
|
108
|
+
.paths()
|
|
109
|
+
.map((node) => node.value.id.name)
|
|
110
|
+
|
|
111
|
+
const isCallExpression = (node) =>
|
|
112
|
+
jscodeshift.match(node, { type: jscodeshift.CallExpression.name })
|
|
113
|
+
|
|
114
|
+
const isIdentifier = (node) =>
|
|
115
|
+
jscodeshift.match(node, { type: jscodeshift.Identifier.name })
|
|
116
|
+
|
|
117
|
+
const isMemberExpression = (node) =>
|
|
118
|
+
jscodeshift.match(node, { type: jscodeshift.MemberExpression.name })
|
|
119
|
+
|
|
120
|
+
const isNewExpression = (node) =>
|
|
121
|
+
jscodeshift.match(node, { type: jscodeshift.NewExpression.name })
|
|
122
|
+
|
|
123
|
+
const isArrayExpression = (node) =>
|
|
124
|
+
jscodeshift.match(node, { type: jscodeshift.ArrayExpression.name })
|
|
125
|
+
|
|
126
|
+
const isObjectExpression = (node) =>
|
|
127
|
+
jscodeshift.match(node, { type: jscodeshift.ObjectExpression.name })
|
|
128
|
+
|
|
129
|
+
const isObjectProperty = (node) =>
|
|
130
|
+
jscodeshift.match(node, { type: jscodeshift.ObjectProperty.name })
|
|
131
|
+
|
|
132
|
+
const isSpreadElement = (node) =>
|
|
133
|
+
jscodeshift.match(node, { type: jscodeshift.SpreadElement.name })
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @param {import('jscodeshift').Node} node
|
|
137
|
+
* @returns {boolean}
|
|
138
|
+
*/
|
|
139
|
+
const isFunctionDefinition = (node) => {
|
|
140
|
+
const isArrowFunctionExpression = jscodeshift.match(node, {
|
|
141
|
+
type: jscodeshift.ArrowFunctionExpression.name,
|
|
142
|
+
})
|
|
143
|
+
const isFunctionExpression = jscodeshift.match(node, {
|
|
144
|
+
type: jscodeshift.FunctionExpression.name,
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
return isArrowFunctionExpression || isFunctionExpression
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const warn = (message) => {
|
|
151
|
+
if (process.env.NODE_ENV !== 'test') {
|
|
152
|
+
console.warn(message)
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const isClassInstantiationOf = (node, selector) => {
|
|
157
|
+
if (!isNewExpression(node)) {
|
|
158
|
+
return false
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const parts = selector.split('.')
|
|
162
|
+
|
|
163
|
+
return parts.length === 1
|
|
164
|
+
? isIdentifier(node.callee) && node.callee.name === parts[0]
|
|
165
|
+
: isMemberExpression(node.callee) &&
|
|
166
|
+
node.callee.object.name === parts[0] &&
|
|
167
|
+
node.callee.property.name === parts[1]
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const isFunctionCallOf = (node, selector) => {
|
|
171
|
+
if (!isCallExpression(node)) {
|
|
172
|
+
return false
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const parts = selector.split('.')
|
|
176
|
+
|
|
177
|
+
return parts.length === 1
|
|
178
|
+
? isIdentifier(node.callee) && node.callee.name === parts[0]
|
|
179
|
+
: isMemberExpression(node.callee) &&
|
|
180
|
+
node.callee.object.name === parts[0] &&
|
|
181
|
+
node.callee.property.name === parts[1]
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const getSelectorByImports = (imports, path) =>
|
|
185
|
+
imports.namespace
|
|
186
|
+
? `${imports.namespace.name}.${imports[path].name}`
|
|
187
|
+
: imports[path].name
|
|
188
|
+
|
|
189
|
+
return {
|
|
190
|
+
findAllMethodCalls,
|
|
191
|
+
getSelectorByImports,
|
|
192
|
+
isCallExpression,
|
|
193
|
+
isClassInstantiationOf,
|
|
194
|
+
isFunctionCallOf,
|
|
195
|
+
isIdentifier,
|
|
196
|
+
isMemberExpression,
|
|
197
|
+
isArrayExpression,
|
|
198
|
+
isObjectExpression,
|
|
199
|
+
isObjectProperty,
|
|
200
|
+
isSpreadElement,
|
|
201
|
+
isFunctionDefinition,
|
|
202
|
+
locateImports,
|
|
203
|
+
warn,
|
|
204
|
+
queryClient: {
|
|
205
|
+
findQueryClientIdentifiers,
|
|
206
|
+
},
|
|
207
|
+
}
|
|
208
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
module.exports = ({
|
|
2
|
+
jscodeshift,
|
|
3
|
+
utils,
|
|
4
|
+
root,
|
|
5
|
+
packageName = '@tanstack/react-query',
|
|
6
|
+
}) => {
|
|
7
|
+
const isGetQueryCacheMethodCall = (
|
|
8
|
+
initializer,
|
|
9
|
+
importIdentifiers,
|
|
10
|
+
knownQueryClientIds,
|
|
11
|
+
) => {
|
|
12
|
+
const isKnownQueryClient = (node) =>
|
|
13
|
+
utils.isIdentifier(node) && knownQueryClientIds.includes(node.name)
|
|
14
|
+
|
|
15
|
+
const isGetQueryCacheIdentifier = (node) =>
|
|
16
|
+
utils.isIdentifier(node) && node.name === 'getQueryCache'
|
|
17
|
+
|
|
18
|
+
const isValidInitializer = (node) =>
|
|
19
|
+
utils.isCallExpression(node) && utils.isMemberExpression(node.callee)
|
|
20
|
+
|
|
21
|
+
if (isValidInitializer(initializer)) {
|
|
22
|
+
const instance = initializer.callee.object
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
isGetQueryCacheIdentifier(initializer.callee.property) &&
|
|
26
|
+
(isKnownQueryClient(instance) ||
|
|
27
|
+
utils.isFunctionCallOf(
|
|
28
|
+
instance,
|
|
29
|
+
utils.getSelectorByImports(importIdentifiers, 'useQueryClient'),
|
|
30
|
+
))
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return false
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const findQueryCacheInstantiations = (
|
|
38
|
+
importIdentifiers,
|
|
39
|
+
knownQueryClientIds,
|
|
40
|
+
) =>
|
|
41
|
+
root.find(jscodeshift.VariableDeclarator, {}).filter((node) => {
|
|
42
|
+
if (node.value.init) {
|
|
43
|
+
const initializer = node.value.init
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
utils.isClassInstantiationOf(
|
|
47
|
+
initializer,
|
|
48
|
+
utils.getSelectorByImports(importIdentifiers, 'QueryCache'),
|
|
49
|
+
) ||
|
|
50
|
+
isGetQueryCacheMethodCall(
|
|
51
|
+
initializer,
|
|
52
|
+
importIdentifiers,
|
|
53
|
+
knownQueryClientIds,
|
|
54
|
+
)
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return false
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
const filterQueryCacheMethodCalls = (node) =>
|
|
62
|
+
utils.isIdentifier(node) && ['find', 'findAll'].includes(node.name)
|
|
63
|
+
|
|
64
|
+
const findQueryCacheMethodCalls = (importIdentifiers) => {
|
|
65
|
+
/**
|
|
66
|
+
* Here we collect all query client instantiations. We have to make aware of them because the query cache can be
|
|
67
|
+
* accessed by the query client as well.
|
|
68
|
+
*/
|
|
69
|
+
const queryClientIdentifiers =
|
|
70
|
+
utils.queryClient.findQueryClientIdentifiers(importIdentifiers)
|
|
71
|
+
/**
|
|
72
|
+
* Here we collect all query cache instantiations. The reason is simple: the methods can be called on query cache
|
|
73
|
+
* instances, to locate the possible usages we need to be aware of the identifier names.
|
|
74
|
+
*/
|
|
75
|
+
const queryCacheIdentifiers = findQueryCacheInstantiations(
|
|
76
|
+
importIdentifiers,
|
|
77
|
+
queryClientIdentifiers,
|
|
78
|
+
)
|
|
79
|
+
.paths()
|
|
80
|
+
.map((node) => node.value.id.name)
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
utils
|
|
84
|
+
// First, we need to find all method calls.
|
|
85
|
+
.findAllMethodCalls()
|
|
86
|
+
// Then we narrow the collection to all `fetch` and `fetchAll` methods.
|
|
87
|
+
.filter((node) =>
|
|
88
|
+
filterQueryCacheMethodCalls(node.value.callee.property),
|
|
89
|
+
)
|
|
90
|
+
.filter((node) => {
|
|
91
|
+
const object = node.value.callee.object
|
|
92
|
+
|
|
93
|
+
// If the method is called on a `QueryCache` instance, we keep it in the collection.
|
|
94
|
+
if (utils.isIdentifier(object)) {
|
|
95
|
+
return queryCacheIdentifiers.includes(object.name)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// If the method is called on a `QueryClient` instance, we keep it in the collection.
|
|
99
|
+
if (utils.isCallExpression(object)) {
|
|
100
|
+
return isGetQueryCacheMethodCall(
|
|
101
|
+
object,
|
|
102
|
+
importIdentifiers,
|
|
103
|
+
queryClientIdentifiers,
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return false
|
|
108
|
+
})
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const execute = (replacer) => {
|
|
113
|
+
findQueryCacheMethodCalls(
|
|
114
|
+
utils.locateImports(
|
|
115
|
+
['QueryCache', 'QueryClient', 'useQueryClient'],
|
|
116
|
+
packageName,
|
|
117
|
+
),
|
|
118
|
+
).replaceWith(replacer)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return {
|
|
122
|
+
execute,
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
module.exports = ({
|
|
2
|
+
jscodeshift,
|
|
3
|
+
utils,
|
|
4
|
+
root,
|
|
5
|
+
packageName = '@tanstack/react-query',
|
|
6
|
+
}) => {
|
|
7
|
+
const filterQueryClientMethodCalls = (node, methods) =>
|
|
8
|
+
utils.isIdentifier(node) && methods.includes(node.name)
|
|
9
|
+
|
|
10
|
+
const findQueryClientMethodCalls = (importIdentifiers, methods) => {
|
|
11
|
+
/**
|
|
12
|
+
* Here we collect all query client instantiations. We have to make aware of them because some method calls might
|
|
13
|
+
* be invoked on these instances.
|
|
14
|
+
*/
|
|
15
|
+
const queryClientIdentifiers =
|
|
16
|
+
utils.queryClient.findQueryClientIdentifiers(importIdentifiers)
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
utils
|
|
20
|
+
// First, we need to find all method calls.
|
|
21
|
+
.findAllMethodCalls()
|
|
22
|
+
// Then we narrow the collection to `QueryClient` methods.
|
|
23
|
+
.filter((node) =>
|
|
24
|
+
filterQueryClientMethodCalls(node.value.callee.property, methods),
|
|
25
|
+
)
|
|
26
|
+
.filter((node) => {
|
|
27
|
+
const object = node.value.callee.object
|
|
28
|
+
|
|
29
|
+
// If the method is called on a `QueryClient` instance, we keep it in the collection.
|
|
30
|
+
if (utils.isIdentifier(object)) {
|
|
31
|
+
return queryClientIdentifiers.includes(object.name)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// If the method is called on the return value of `useQueryClient` hook, we keep it in the collection.
|
|
35
|
+
return utils.isFunctionCallOf(
|
|
36
|
+
object,
|
|
37
|
+
utils.getSelectorByImports(importIdentifiers, 'useQueryClient'),
|
|
38
|
+
)
|
|
39
|
+
})
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const execute = (methods, replacer) => {
|
|
44
|
+
findQueryClientMethodCalls(
|
|
45
|
+
utils.locateImports(['QueryClient', 'useQueryClient'], packageName),
|
|
46
|
+
methods,
|
|
47
|
+
).replaceWith(replacer)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
execute,
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
module.exports = ({
|
|
2
|
+
jscodeshift,
|
|
3
|
+
utils,
|
|
4
|
+
root,
|
|
5
|
+
packageName = '@tanstack/react-query',
|
|
6
|
+
}) => {
|
|
7
|
+
const filterUseQueryLikeHookCalls = (node, importIdentifiers, hooks) => {
|
|
8
|
+
for (const hook of hooks) {
|
|
9
|
+
const selector = utils.getSelectorByImports(importIdentifiers, hook)
|
|
10
|
+
|
|
11
|
+
if (utils.isFunctionCallOf(node, selector)) {
|
|
12
|
+
return true
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return false
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const findUseQueryLikeHookCalls = (importIdentifiers, hooks) =>
|
|
20
|
+
root
|
|
21
|
+
// First, we need to find all call expressions.
|
|
22
|
+
.find(jscodeshift.CallExpression, {})
|
|
23
|
+
// Then we narrow the collection to the `useQuery` like hook calls.
|
|
24
|
+
.filter((node) =>
|
|
25
|
+
filterUseQueryLikeHookCalls(node.value, importIdentifiers, hooks),
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
const execute = (hooks, replacer) => {
|
|
29
|
+
findUseQueryLikeHookCalls(
|
|
30
|
+
utils.locateImports(hooks, packageName),
|
|
31
|
+
hooks,
|
|
32
|
+
).replaceWith(replacer)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
execute,
|
|
37
|
+
}
|
|
38
|
+
}
|