@tanstack/vue-query 5.102.8 → 5.103.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/legacy/devtools/devtools.d.cts +1 -1
- package/build/legacy/devtools/devtools.d.ts +1 -1
- package/build/legacy/index.d.cts +8 -6
- package/build/legacy/index.d.ts +8 -6
- package/build/legacy/infiniteQueryOptions-CEDiLwh5.d.ts +365 -0
- package/build/legacy/infiniteQueryOptions-CEDiLwh5.d.ts.map +1 -0
- package/build/legacy/infiniteQueryOptions-qN6sOJM-.d.cts +365 -0
- package/build/legacy/infiniteQueryOptions-qN6sOJM-.d.cts.map +1 -0
- package/build/legacy/infiniteQueryOptions.cjs.map +1 -1
- package/build/legacy/infiniteQueryOptions.d.cts +1 -1
- package/build/legacy/infiniteQueryOptions.d.ts +1 -1
- package/build/legacy/infiniteQueryOptions.js.map +1 -1
- package/build/legacy/mutationCache.cjs +5 -0
- package/build/legacy/mutationCache.cjs.map +1 -1
- package/build/legacy/mutationCache.d.cts +6 -1
- package/build/legacy/mutationCache.d.cts.map +1 -1
- package/build/legacy/mutationCache.d.ts +6 -1
- package/build/legacy/mutationCache.d.ts.map +1 -1
- package/build/legacy/mutationCache.js +5 -0
- package/build/legacy/mutationCache.js.map +1 -1
- package/build/legacy/mutationOptions.cjs.map +1 -1
- package/build/legacy/mutationOptions.d.cts +121 -1
- package/build/legacy/mutationOptions.d.cts.map +1 -1
- package/build/legacy/mutationOptions.d.ts +121 -1
- package/build/legacy/mutationOptions.d.ts.map +1 -1
- package/build/legacy/mutationOptions.js.map +1 -1
- package/build/legacy/queryCache.cjs +5 -0
- package/build/legacy/queryCache.cjs.map +1 -1
- package/build/legacy/queryCache.d.cts +6 -1
- package/build/legacy/queryCache.d.cts.map +1 -1
- package/build/legacy/queryCache.d.ts +6 -1
- package/build/legacy/queryCache.d.ts.map +1 -1
- package/build/legacy/queryCache.js +5 -0
- package/build/legacy/queryCache.js.map +1 -1
- package/build/legacy/queryClient-CZeNAt68.d.cts +71 -0
- package/build/legacy/queryClient-CZeNAt68.d.cts.map +1 -0
- package/build/legacy/queryClient-Cv73nzNT.d.ts +71 -0
- package/build/legacy/queryClient-Cv73nzNT.d.ts.map +1 -0
- package/build/legacy/queryClient.cjs +7 -0
- package/build/legacy/queryClient.cjs.map +1 -1
- package/build/legacy/queryClient.d.cts +1 -1
- package/build/legacy/queryClient.d.ts +1 -1
- package/build/legacy/queryClient.js +7 -0
- package/build/legacy/queryClient.js.map +1 -1
- package/build/legacy/queryOptions-DPDwdVBu.d.ts +227 -0
- package/build/legacy/queryOptions-DPDwdVBu.d.ts.map +1 -0
- package/build/legacy/queryOptions-rkZ3sk6g.d.cts +227 -0
- package/build/legacy/queryOptions-rkZ3sk6g.d.cts.map +1 -0
- package/build/legacy/queryOptions.cjs.map +1 -1
- package/build/legacy/queryOptions.d.cts +2 -19
- package/build/legacy/queryOptions.d.ts +2 -19
- package/build/legacy/queryOptions.js.map +1 -1
- package/build/{modern/types-BzZi3_rS.d.cts → legacy/types-JpJB72CS.d.cts} +19 -1
- package/build/legacy/types-JpJB72CS.d.cts.map +1 -0
- package/build/legacy/{types-BzZi3_rS.d.cts → types-JpJB72CS.d.ts} +19 -1
- package/build/legacy/types-JpJB72CS.d.ts.map +1 -0
- package/build/legacy/types.d.cts +1 -1
- package/build/legacy/types.d.ts +1 -1
- package/build/legacy/useBaseQuery.cjs +8 -0
- package/build/legacy/useBaseQuery.cjs.map +1 -1
- package/build/legacy/useBaseQuery.d.cts +1 -1
- package/build/legacy/useBaseQuery.d.ts +1 -1
- package/build/legacy/useBaseQuery.js +8 -0
- package/build/legacy/useBaseQuery.js.map +1 -1
- package/build/legacy/useInfiniteQuery.cjs.map +1 -1
- package/build/legacy/useInfiniteQuery.d.cts +1 -1
- package/build/legacy/useInfiniteQuery.d.ts +1 -1
- package/build/legacy/useInfiniteQuery.js.map +1 -1
- package/build/legacy/useIsFetching.cjs +41 -0
- package/build/legacy/useIsFetching.cjs.map +1 -1
- package/build/legacy/useIsFetching.d.cts +47 -6
- package/build/legacy/useIsFetching.d.cts.map +1 -1
- package/build/legacy/useIsFetching.d.ts +47 -6
- package/build/legacy/useIsFetching.d.ts.map +1 -1
- package/build/legacy/useIsFetching.js +41 -0
- package/build/legacy/useIsFetching.js.map +1 -1
- package/build/legacy/useMutation.cjs +170 -9
- package/build/legacy/useMutation.cjs.map +1 -1
- package/build/legacy/useMutation.d.cts +164 -3
- package/build/legacy/useMutation.d.cts.map +1 -1
- package/build/legacy/useMutation.d.ts +164 -3
- package/build/legacy/useMutation.d.ts.map +1 -1
- package/build/legacy/useMutation.js +170 -9
- package/build/legacy/useMutation.js.map +1 -1
- package/build/legacy/useMutationState.cjs +103 -0
- package/build/legacy/useMutationState.cjs.map +1 -1
- package/build/legacy/useMutationState.d.cts +111 -7
- package/build/legacy/useMutationState.d.cts.map +1 -1
- package/build/legacy/useMutationState.d.ts +111 -7
- package/build/legacy/useMutationState.d.ts.map +1 -1
- package/build/legacy/useMutationState.js +103 -0
- package/build/legacy/useMutationState.js.map +1 -1
- package/build/legacy/usePrefetchInfiniteQuery.cjs +46 -0
- package/build/legacy/usePrefetchInfiniteQuery.cjs.map +1 -1
- package/build/legacy/usePrefetchInfiniteQuery.d.cts +48 -2
- package/build/legacy/usePrefetchInfiniteQuery.d.cts.map +1 -1
- package/build/legacy/usePrefetchInfiniteQuery.d.ts +48 -2
- package/build/legacy/usePrefetchInfiniteQuery.d.ts.map +1 -1
- package/build/legacy/usePrefetchInfiniteQuery.js +46 -0
- package/build/legacy/usePrefetchInfiniteQuery.js.map +1 -1
- package/build/legacy/usePrefetchQuery.cjs +37 -0
- package/build/legacy/usePrefetchQuery.cjs.map +1 -1
- package/build/legacy/usePrefetchQuery.d.cts +39 -2
- package/build/legacy/usePrefetchQuery.d.cts.map +1 -1
- package/build/legacy/usePrefetchQuery.d.ts +39 -2
- package/build/legacy/usePrefetchQuery.d.ts.map +1 -1
- package/build/legacy/usePrefetchQuery.js +37 -0
- package/build/legacy/usePrefetchQuery.js.map +1 -1
- package/build/legacy/useQueries.cjs +123 -0
- package/build/legacy/useQueries.cjs.map +1 -1
- package/build/legacy/useQueries.d.cts +126 -2
- package/build/legacy/useQueries.d.cts.map +1 -1
- package/build/legacy/useQueries.d.ts +126 -2
- package/build/legacy/useQueries.d.ts.map +1 -1
- package/build/legacy/useQueries.js +123 -0
- package/build/legacy/useQueries.js.map +1 -1
- package/build/legacy/useQuery.cjs.map +1 -1
- package/build/legacy/useQuery.d.cts +248 -2
- package/build/legacy/useQuery.d.cts.map +1 -0
- package/build/legacy/useQuery.d.ts +248 -2
- package/build/legacy/useQuery.d.ts.map +1 -0
- package/build/legacy/useQuery.js.map +1 -1
- package/build/legacy/useQueryClient.cjs +21 -0
- package/build/legacy/useQueryClient.cjs.map +1 -1
- package/build/legacy/useQueryClient.d.cts +22 -1
- package/build/legacy/useQueryClient.d.cts.map +1 -1
- package/build/legacy/useQueryClient.d.ts +22 -1
- package/build/legacy/useQueryClient.d.ts.map +1 -1
- package/build/legacy/useQueryClient.js +21 -0
- package/build/legacy/useQueryClient.js.map +1 -1
- package/build/legacy/utils.cjs +15 -0
- package/build/legacy/utils.cjs.map +1 -1
- package/build/legacy/utils.d.cts +16 -1
- package/build/legacy/utils.d.cts.map +1 -1
- package/build/legacy/utils.d.ts +16 -1
- package/build/legacy/utils.d.ts.map +1 -1
- package/build/legacy/utils.js +15 -0
- package/build/legacy/utils.js.map +1 -1
- package/build/legacy/vueQueryPlugin.cjs +34 -0
- package/build/legacy/vueQueryPlugin.cjs.map +1 -1
- package/build/legacy/vueQueryPlugin.d.cts +48 -2
- package/build/legacy/vueQueryPlugin.d.cts.map +1 -1
- package/build/legacy/vueQueryPlugin.d.ts +48 -2
- package/build/legacy/vueQueryPlugin.d.ts.map +1 -1
- package/build/legacy/vueQueryPlugin.js +34 -0
- package/build/legacy/vueQueryPlugin.js.map +1 -1
- package/build/modern/devtools/devtools.d.cts +1 -1
- package/build/modern/devtools/devtools.d.ts +1 -1
- package/build/modern/index.d.cts +8 -6
- package/build/modern/index.d.ts +8 -6
- package/build/modern/infiniteQueryOptions-CEDiLwh5.d.ts +365 -0
- package/build/modern/infiniteQueryOptions-CEDiLwh5.d.ts.map +1 -0
- package/build/modern/infiniteQueryOptions-qN6sOJM-.d.cts +365 -0
- package/build/modern/infiniteQueryOptions-qN6sOJM-.d.cts.map +1 -0
- package/build/modern/infiniteQueryOptions.cjs.map +1 -1
- package/build/modern/infiniteQueryOptions.d.cts +1 -1
- package/build/modern/infiniteQueryOptions.d.ts +1 -1
- package/build/modern/infiniteQueryOptions.js.map +1 -1
- package/build/modern/mutationCache.cjs +5 -0
- package/build/modern/mutationCache.cjs.map +1 -1
- package/build/modern/mutationCache.d.cts +6 -1
- package/build/modern/mutationCache.d.cts.map +1 -1
- package/build/modern/mutationCache.d.ts +6 -1
- package/build/modern/mutationCache.d.ts.map +1 -1
- package/build/modern/mutationCache.js +5 -0
- package/build/modern/mutationCache.js.map +1 -1
- package/build/modern/mutationOptions.cjs.map +1 -1
- package/build/modern/mutationOptions.d.cts +121 -1
- package/build/modern/mutationOptions.d.cts.map +1 -1
- package/build/modern/mutationOptions.d.ts +121 -1
- package/build/modern/mutationOptions.d.ts.map +1 -1
- package/build/modern/mutationOptions.js.map +1 -1
- package/build/modern/queryCache.cjs +5 -0
- package/build/modern/queryCache.cjs.map +1 -1
- package/build/modern/queryCache.d.cts +6 -1
- package/build/modern/queryCache.d.cts.map +1 -1
- package/build/modern/queryCache.d.ts +6 -1
- package/build/modern/queryCache.d.ts.map +1 -1
- package/build/modern/queryCache.js +5 -0
- package/build/modern/queryCache.js.map +1 -1
- package/build/modern/queryClient-CZeNAt68.d.cts +71 -0
- package/build/modern/queryClient-CZeNAt68.d.cts.map +1 -0
- package/build/modern/queryClient-Cv73nzNT.d.ts +71 -0
- package/build/modern/queryClient-Cv73nzNT.d.ts.map +1 -0
- package/build/modern/queryClient.cjs +7 -0
- package/build/modern/queryClient.cjs.map +1 -1
- package/build/modern/queryClient.d.cts +1 -1
- package/build/modern/queryClient.d.ts +1 -1
- package/build/modern/queryClient.js +7 -0
- package/build/modern/queryClient.js.map +1 -1
- package/build/modern/queryOptions-DPDwdVBu.d.ts +227 -0
- package/build/modern/queryOptions-DPDwdVBu.d.ts.map +1 -0
- package/build/modern/queryOptions-rkZ3sk6g.d.cts +227 -0
- package/build/modern/queryOptions-rkZ3sk6g.d.cts.map +1 -0
- package/build/modern/queryOptions.cjs.map +1 -1
- package/build/modern/queryOptions.d.cts +2 -19
- package/build/modern/queryOptions.d.ts +2 -19
- package/build/modern/queryOptions.js.map +1 -1
- package/build/modern/{types-BzZi3_rS.d.ts → types-JpJB72CS.d.cts} +19 -1
- package/build/modern/types-JpJB72CS.d.cts.map +1 -0
- package/build/{legacy/types-BzZi3_rS.d.ts → modern/types-JpJB72CS.d.ts} +19 -1
- package/build/modern/types-JpJB72CS.d.ts.map +1 -0
- package/build/modern/types.d.cts +1 -1
- package/build/modern/types.d.ts +1 -1
- package/build/modern/useBaseQuery.cjs +8 -0
- package/build/modern/useBaseQuery.cjs.map +1 -1
- package/build/modern/useBaseQuery.d.cts +1 -1
- package/build/modern/useBaseQuery.d.ts +1 -1
- package/build/modern/useBaseQuery.js +8 -0
- package/build/modern/useBaseQuery.js.map +1 -1
- package/build/modern/useInfiniteQuery.cjs.map +1 -1
- package/build/modern/useInfiniteQuery.d.cts +1 -1
- package/build/modern/useInfiniteQuery.d.ts +1 -1
- package/build/modern/useInfiniteQuery.js.map +1 -1
- package/build/modern/useIsFetching.cjs +41 -0
- package/build/modern/useIsFetching.cjs.map +1 -1
- package/build/modern/useIsFetching.d.cts +47 -6
- package/build/modern/useIsFetching.d.cts.map +1 -1
- package/build/modern/useIsFetching.d.ts +47 -6
- package/build/modern/useIsFetching.d.ts.map +1 -1
- package/build/modern/useIsFetching.js +41 -0
- package/build/modern/useIsFetching.js.map +1 -1
- package/build/modern/useMutation.cjs +170 -9
- package/build/modern/useMutation.cjs.map +1 -1
- package/build/modern/useMutation.d.cts +164 -3
- package/build/modern/useMutation.d.cts.map +1 -1
- package/build/modern/useMutation.d.ts +164 -3
- package/build/modern/useMutation.d.ts.map +1 -1
- package/build/modern/useMutation.js +170 -9
- package/build/modern/useMutation.js.map +1 -1
- package/build/modern/useMutationState.cjs +103 -0
- package/build/modern/useMutationState.cjs.map +1 -1
- package/build/modern/useMutationState.d.cts +111 -7
- package/build/modern/useMutationState.d.cts.map +1 -1
- package/build/modern/useMutationState.d.ts +111 -7
- package/build/modern/useMutationState.d.ts.map +1 -1
- package/build/modern/useMutationState.js +103 -0
- package/build/modern/useMutationState.js.map +1 -1
- package/build/modern/usePrefetchInfiniteQuery.cjs +46 -0
- package/build/modern/usePrefetchInfiniteQuery.cjs.map +1 -1
- package/build/modern/usePrefetchInfiniteQuery.d.cts +48 -2
- package/build/modern/usePrefetchInfiniteQuery.d.cts.map +1 -1
- package/build/modern/usePrefetchInfiniteQuery.d.ts +48 -2
- package/build/modern/usePrefetchInfiniteQuery.d.ts.map +1 -1
- package/build/modern/usePrefetchInfiniteQuery.js +46 -0
- package/build/modern/usePrefetchInfiniteQuery.js.map +1 -1
- package/build/modern/usePrefetchQuery.cjs +37 -0
- package/build/modern/usePrefetchQuery.cjs.map +1 -1
- package/build/modern/usePrefetchQuery.d.cts +39 -2
- package/build/modern/usePrefetchQuery.d.cts.map +1 -1
- package/build/modern/usePrefetchQuery.d.ts +39 -2
- package/build/modern/usePrefetchQuery.d.ts.map +1 -1
- package/build/modern/usePrefetchQuery.js +37 -0
- package/build/modern/usePrefetchQuery.js.map +1 -1
- package/build/modern/useQueries.cjs +123 -0
- package/build/modern/useQueries.cjs.map +1 -1
- package/build/modern/useQueries.d.cts +126 -2
- package/build/modern/useQueries.d.cts.map +1 -1
- package/build/modern/useQueries.d.ts +126 -2
- package/build/modern/useQueries.d.ts.map +1 -1
- package/build/modern/useQueries.js +123 -0
- package/build/modern/useQueries.js.map +1 -1
- package/build/modern/useQuery.cjs.map +1 -1
- package/build/modern/useQuery.d.cts +248 -2
- package/build/modern/useQuery.d.cts.map +1 -0
- package/build/modern/useQuery.d.ts +248 -2
- package/build/modern/useQuery.d.ts.map +1 -0
- package/build/modern/useQuery.js.map +1 -1
- package/build/modern/useQueryClient.cjs +21 -0
- package/build/modern/useQueryClient.cjs.map +1 -1
- package/build/modern/useQueryClient.d.cts +22 -1
- package/build/modern/useQueryClient.d.cts.map +1 -1
- package/build/modern/useQueryClient.d.ts +22 -1
- package/build/modern/useQueryClient.d.ts.map +1 -1
- package/build/modern/useQueryClient.js +21 -0
- package/build/modern/useQueryClient.js.map +1 -1
- package/build/modern/utils.cjs +15 -0
- package/build/modern/utils.cjs.map +1 -1
- package/build/modern/utils.d.cts +16 -1
- package/build/modern/utils.d.cts.map +1 -1
- package/build/modern/utils.d.ts +16 -1
- package/build/modern/utils.d.ts.map +1 -1
- package/build/modern/utils.js +15 -0
- package/build/modern/utils.js.map +1 -1
- package/build/modern/vueQueryPlugin.cjs +34 -0
- package/build/modern/vueQueryPlugin.cjs.map +1 -1
- package/build/modern/vueQueryPlugin.d.cts +48 -2
- package/build/modern/vueQueryPlugin.d.cts.map +1 -1
- package/build/modern/vueQueryPlugin.d.ts +48 -2
- package/build/modern/vueQueryPlugin.d.ts.map +1 -1
- package/build/modern/vueQueryPlugin.js +34 -0
- package/build/modern/vueQueryPlugin.js.map +1 -1
- package/package.json +10 -10
- package/src/index.ts +9 -9
- package/src/infiniteQueryOptions.ts +86 -0
- package/src/mutationCache.ts +5 -0
- package/src/mutationOptions.ts +123 -0
- package/src/queryCache.ts +5 -0
- package/src/queryClient.ts +17 -1
- package/src/queryOptions.ts +276 -10
- package/src/types.ts +18 -0
- package/src/useBaseQuery.ts +9 -1
- package/src/useInfiniteQuery.ts +240 -0
- package/src/useIsFetching.ts +46 -3
- package/src/useMutation.ts +170 -17
- package/src/useMutationState.ts +111 -4
- package/src/usePrefetchInfiniteQuery.ts +46 -0
- package/src/usePrefetchQuery.ts +37 -0
- package/src/useQueries.ts +124 -1
- package/src/useQuery.ts +240 -79
- package/src/useQueryClient.ts +21 -0
- package/src/utils.ts +15 -0
- package/src/vueQueryPlugin.ts +46 -0
- package/build/legacy/queryClient-C07d0chJ.d.cts +0 -97
- package/build/legacy/queryClient-C07d0chJ.d.cts.map +0 -1
- package/build/legacy/queryClient-hf6i_vCa.d.ts +0 -97
- package/build/legacy/queryClient-hf6i_vCa.d.ts.map +0 -1
- package/build/legacy/queryOptions.d.cts.map +0 -1
- package/build/legacy/queryOptions.d.ts.map +0 -1
- package/build/legacy/types-BzZi3_rS.d.cts.map +0 -1
- package/build/legacy/types-BzZi3_rS.d.ts.map +0 -1
- package/build/modern/queryClient-C07d0chJ.d.cts +0 -97
- package/build/modern/queryClient-C07d0chJ.d.cts.map +0 -1
- package/build/modern/queryClient-hf6i_vCa.d.ts +0 -97
- package/build/modern/queryClient-hf6i_vCa.d.ts.map +0 -1
- package/build/modern/queryOptions.d.cts.map +0 -1
- package/build/modern/queryOptions.d.ts.map +0 -1
- package/build/modern/types-BzZi3_rS.d.cts.map +0 -1
- package/build/modern/types-BzZi3_rS.d.ts.map +0 -1
package/build/modern/index.d.cts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { c as MutationOptions } from "./types-JpJB72CS.cjs";
|
|
2
|
+
import { a as UndefinedInitialQueryOptionsWithDataTag, i as UndefinedInitialQueryOptions, n as DefinedInitialQueryOptionsWithDataTag, o as UseQueryOptions, r as QueryOptions, s as queryOptions, t as DefinedInitialQueryOptions } from "./queryOptions-rkZ3sk6g.cjs";
|
|
3
|
+
import { t as QueryClient } from "./queryClient-CZeNAt68.cjs";
|
|
3
4
|
import { useQueryClient } from "./useQueryClient.cjs";
|
|
4
5
|
import { VueQueryPlugin, VueQueryPluginOptions } from "./vueQueryPlugin.cjs";
|
|
5
6
|
import { QueryCache } from "./queryCache.cjs";
|
|
6
|
-
import {
|
|
7
|
+
import { a as UseInfiniteQueryReturnType, i as UseInfiniteQueryOptions, n as UndefinedInitialDataInfiniteOptions, o as useInfiniteQuery, r as infiniteQueryOptions, t as DefinedInitialDataInfiniteOptions } from "./infiniteQueryOptions-qN6sOJM-.cjs";
|
|
7
8
|
import { MutationCache } from "./mutationCache.cjs";
|
|
8
9
|
import { mutationOptions } from "./mutationOptions.cjs";
|
|
10
|
+
import { UseQueryDefinedReturnType, UseQueryReturnType, useQuery } from "./useQuery.cjs";
|
|
9
11
|
import { UseQueriesOptions, UseQueriesResults, useQueries } from "./useQueries.cjs";
|
|
10
12
|
import { UsePrefetchQueryOptions, usePrefetchQuery } from "./usePrefetchQuery.cjs";
|
|
11
13
|
import { UsePrefetchInfiniteQueryOptions, usePrefetchInfiniteQuery } from "./usePrefetchInfiniteQuery.cjs";
|
|
12
14
|
import { UseMutationOptions, UseMutationReturnType, useMutation } from "./useMutation.cjs";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
+
import { UseIsFetchingFilters, useIsFetching } from "./useIsFetching.cjs";
|
|
16
|
+
import { MutationStateOptions, UseIsMutatingFilters, useIsMutating, useMutationState } from "./useMutationState.cjs";
|
|
15
17
|
import { VUE_QUERY_CLIENT } from "./utils.cjs";
|
|
16
18
|
export * from "@tanstack/query-core";
|
|
17
|
-
export { type DefinedInitialDataInfiniteOptions, type DefinedInitialQueryOptions, type DefinedInitialQueryOptionsWithDataTag, MutationCache, type
|
|
19
|
+
export { type DefinedInitialDataInfiniteOptions, type DefinedInitialQueryOptions, type DefinedInitialQueryOptionsWithDataTag, MutationCache, type MutationOptions, type MutationStateOptions, QueryCache, QueryClient, type QueryOptions, type UndefinedInitialDataInfiniteOptions, type UndefinedInitialQueryOptions, type UndefinedInitialQueryOptionsWithDataTag, type UseInfiniteQueryOptions, type UseInfiniteQueryReturnType, type UseIsFetchingFilters, type UseIsMutatingFilters, type UseMutationOptions, type UseMutationReturnType, type UsePrefetchInfiniteQueryOptions, type UsePrefetchQueryOptions, type UseQueriesOptions, type UseQueriesResults, type UseQueryDefinedReturnType, type UseQueryOptions, type UseQueryReturnType, VUE_QUERY_CLIENT, VueQueryPlugin, type VueQueryPluginOptions, infiniteQueryOptions, mutationOptions, queryOptions, useInfiniteQuery, useIsFetching, useIsMutating, useMutation, useMutationState, usePrefetchInfiniteQuery, usePrefetchQuery, useQueries, useQuery, useQueryClient };
|
package/build/modern/index.d.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { c as MutationOptions } from "./types-JpJB72CS.js";
|
|
2
|
+
import { a as UndefinedInitialQueryOptionsWithDataTag, i as UndefinedInitialQueryOptions, n as DefinedInitialQueryOptionsWithDataTag, o as UseQueryOptions, r as QueryOptions, s as queryOptions, t as DefinedInitialQueryOptions } from "./queryOptions-DPDwdVBu.js";
|
|
3
|
+
import { t as QueryClient } from "./queryClient-Cv73nzNT.js";
|
|
3
4
|
import { useQueryClient } from "./useQueryClient.js";
|
|
4
5
|
import { VueQueryPlugin, VueQueryPluginOptions } from "./vueQueryPlugin.js";
|
|
5
6
|
import { QueryCache } from "./queryCache.js";
|
|
6
|
-
import {
|
|
7
|
+
import { a as UseInfiniteQueryReturnType, i as UseInfiniteQueryOptions, n as UndefinedInitialDataInfiniteOptions, o as useInfiniteQuery, r as infiniteQueryOptions, t as DefinedInitialDataInfiniteOptions } from "./infiniteQueryOptions-CEDiLwh5.js";
|
|
7
8
|
import { MutationCache } from "./mutationCache.js";
|
|
8
9
|
import { mutationOptions } from "./mutationOptions.js";
|
|
10
|
+
import { UseQueryDefinedReturnType, UseQueryReturnType, useQuery } from "./useQuery.js";
|
|
9
11
|
import { UseQueriesOptions, UseQueriesResults, useQueries } from "./useQueries.js";
|
|
10
12
|
import { UsePrefetchQueryOptions, usePrefetchQuery } from "./usePrefetchQuery.js";
|
|
11
13
|
import { UsePrefetchInfiniteQueryOptions, usePrefetchInfiniteQuery } from "./usePrefetchInfiniteQuery.js";
|
|
12
14
|
import { UseMutationOptions, UseMutationReturnType, useMutation } from "./useMutation.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
+
import { UseIsFetchingFilters, useIsFetching } from "./useIsFetching.js";
|
|
16
|
+
import { MutationStateOptions, UseIsMutatingFilters, useIsMutating, useMutationState } from "./useMutationState.js";
|
|
15
17
|
import { VUE_QUERY_CLIENT } from "./utils.js";
|
|
16
18
|
export * from "@tanstack/query-core";
|
|
17
|
-
export { type DefinedInitialDataInfiniteOptions, type DefinedInitialQueryOptions, type DefinedInitialQueryOptionsWithDataTag, MutationCache, type
|
|
19
|
+
export { type DefinedInitialDataInfiniteOptions, type DefinedInitialQueryOptions, type DefinedInitialQueryOptionsWithDataTag, MutationCache, type MutationOptions, type MutationStateOptions, QueryCache, QueryClient, type QueryOptions, type UndefinedInitialDataInfiniteOptions, type UndefinedInitialQueryOptions, type UndefinedInitialQueryOptionsWithDataTag, type UseInfiniteQueryOptions, type UseInfiniteQueryReturnType, type UseIsFetchingFilters, type UseIsMutatingFilters, type UseMutationOptions, type UseMutationReturnType, type UsePrefetchInfiniteQueryOptions, type UsePrefetchQueryOptions, type UseQueriesOptions, type UseQueriesResults, type UseQueryDefinedReturnType, type UseQueryOptions, type UseQueryReturnType, VUE_QUERY_CLIENT, VueQueryPlugin, type VueQueryPluginOptions, infiniteQueryOptions, mutationOptions, queryOptions, useInfiniteQuery, useIsFetching, useIsMutating, useMutation, useMutationState, usePrefetchInfiniteQuery, usePrefetchQuery, useQueries, useQuery, useQueryClient };
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
import { a as MaybeRef, d as ShallowOption, o as MaybeRefDeep, s as MaybeRefOrGetter, t as DeepUnwrapRef } from "./types-JpJB72CS.js";
|
|
2
|
+
import { o as UseQueryOptions } from "./queryOptions-DPDwdVBu.js";
|
|
3
|
+
import { t as QueryClient$1 } from "./queryClient-Cv73nzNT.js";
|
|
4
|
+
import { DefaultError, InfiniteData, InfiniteQueryObserverOptions, InfiniteQueryObserverResult, NonUndefinedGuard, QueryKey, QueryKeyWithDataTag, QueryObserver, QueryObserverResult } from "@tanstack/query-core";
|
|
5
|
+
import { Ref } from "vue-demi";
|
|
6
|
+
//#region src/useBaseQuery.d.ts
|
|
7
|
+
type UseBaseQueryReturnType<TData, TError, TResult = QueryObserverResult<TData, TError>> = { [K in keyof TResult]: K extends 'fetchNextPage' | 'fetchPreviousPage' | 'refetch' ? TResult[K] : Ref<Readonly<TResult>[K]>; } & {
|
|
8
|
+
suspense: () => Promise<TResult>;
|
|
9
|
+
};
|
|
10
|
+
type UseQueryOptionsGeneric<TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseQueryOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey> | UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>;
|
|
11
|
+
/**
|
|
12
|
+
* Base implementation shared by `useQuery` and `useInfiniteQuery`.
|
|
13
|
+
*
|
|
14
|
+
* @param Observer - The observer class from query-core (`QueryObserver` or `InfiniteQueryObserver`).
|
|
15
|
+
* @param options - A `ref`, plain value, or reactive getter resolving to the query options.
|
|
16
|
+
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`
|
|
17
|
+
* will be used.
|
|
18
|
+
*/
|
|
19
|
+
declare function useBaseQuery<TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey, TPageParam>(Observer: typeof QueryObserver, options: MaybeRefOrGetter<UseQueryOptionsGeneric<TQueryFnData, TError, TData, TQueryData, TQueryKey, TPageParam>>, queryClient?: QueryClient$1): UseBaseQueryReturnType<TData, TError>;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/useInfiniteQuery.d.ts
|
|
22
|
+
type UseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = MaybeRef<{ [Property in keyof InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>]: Property extends 'enabled' ? MaybeRefOrGetter<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, DeepUnwrapRef<TQueryKey>, TPageParam>[Property]> : MaybeRefDeep<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, DeepUnwrapRef<TQueryKey>, TPageParam>[Property]>; } & ShallowOption>;
|
|
23
|
+
type UseInfiniteQueryReturnType<TData, TError> = UseBaseQueryReturnType<TData, TError, InfiniteQueryObserverResult<TData, TError>>;
|
|
24
|
+
/**
|
|
25
|
+
* The options for `useInfiniteQuery` are identical to `useQuery`, with the addition of
|
|
26
|
+
* `initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`.
|
|
27
|
+
*
|
|
28
|
+
* This overload is selected when `initialData` is set, so the resulting `data` is never `undefined`.
|
|
29
|
+
*
|
|
30
|
+
* `enabled` tracks reactive dependencies automatically as a `ref`, a plain value, or a reactive getter
|
|
31
|
+
* (`() => ...`). `queryKey` reacts through a `ref` for the array itself, or `ref`s and reactive getters as
|
|
32
|
+
* individual entries — the array itself can't be a bare getter.
|
|
33
|
+
*
|
|
34
|
+
* @remarks Keep in mind that imperative fetch calls, such as `fetchNextPage`, may interfere with the default
|
|
35
|
+
* refetch behavior, resulting in outdated data. Make sure to call these functions only in response to user
|
|
36
|
+
* actions, or add conditions like `hasNextPage && !isFetching`.
|
|
37
|
+
* @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to
|
|
38
|
+
* `useInfiniteQuery`, with `initialData` set.
|
|
39
|
+
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`
|
|
40
|
+
* will be used.
|
|
41
|
+
* @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,
|
|
42
|
+
* `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`. `data.value.pages` and
|
|
43
|
+
* `data.value.pageParams` are also added, as long as a `select` doesn't change `TData` away from its default
|
|
44
|
+
* `InfiniteData<TQueryFnData>` shape.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```vue
|
|
48
|
+
* <script setup lang="ts">
|
|
49
|
+
* import { useInfiniteQuery } from '@tanstack/vue-query'
|
|
50
|
+
*
|
|
51
|
+
* // `data` is never `undefined`, thanks to `initialData` — even if a refetch fails, so the
|
|
52
|
+
* // list stays visible alongside the error.
|
|
53
|
+
* const { data, isError, error } = useInfiniteQuery({
|
|
54
|
+
* queryKey: ['projects'],
|
|
55
|
+
* queryFn: ({ pageParam }) => fetchProjects(pageParam),
|
|
56
|
+
* initialPageParam: 0,
|
|
57
|
+
* getNextPageParam: (lastPage) => lastPage.nextId,
|
|
58
|
+
* initialData: { pages: [], pageParams: [] },
|
|
59
|
+
* })
|
|
60
|
+
* </script>
|
|
61
|
+
*
|
|
62
|
+
* <template>
|
|
63
|
+
* <span v-if="isError">Error: {{ error.message }}</span>
|
|
64
|
+
* <ul>
|
|
65
|
+
* <template v-for="page in data.pages" :key="page.nextId">
|
|
66
|
+
* <li v-for="project in page.projects" :key="project.id">{{ project.name }}</li>
|
|
67
|
+
* </template>
|
|
68
|
+
* </ul>
|
|
69
|
+
* </template>
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
declare function useInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: MaybeRefOrGetter<DefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>>, queryClient?: QueryClient$1): UseInfiniteQueryReturnType<TData, TError>;
|
|
73
|
+
/**
|
|
74
|
+
* The options for `useInfiniteQuery` are identical to `useQuery`, with the addition of
|
|
75
|
+
* `initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`.
|
|
76
|
+
*
|
|
77
|
+
* `enabled` tracks reactive dependencies automatically as a `ref`, a plain value, or a reactive getter
|
|
78
|
+
* (`() => ...`). `queryKey` reacts through a `ref` for the array itself, or `ref`s and reactive getters as
|
|
79
|
+
* individual entries — the array itself can't be a bare getter.
|
|
80
|
+
*
|
|
81
|
+
* @remarks Keep in mind that imperative fetch calls, such as `fetchNextPage`, may interfere with the default
|
|
82
|
+
* refetch behavior, resulting in outdated data. Make sure to call these functions only in response to user
|
|
83
|
+
* actions, or add conditions like `hasNextPage && !isFetching`.
|
|
84
|
+
* @param options - The {@link UndefinedInitialDataInfiniteOptions} to use — everything you can pass to
|
|
85
|
+
* `useInfiniteQuery`.
|
|
86
|
+
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`
|
|
87
|
+
* will be used.
|
|
88
|
+
* @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,
|
|
89
|
+
* `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`. `data.value.pages` and
|
|
90
|
+
* `data.value.pageParams` are also added, as long as a `select` doesn't change `TData` away from its default
|
|
91
|
+
* `InfiniteData<TQueryFnData>` shape.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* Fetching the next page from a "Load More" button click:
|
|
95
|
+
* ```vue
|
|
96
|
+
* <script setup lang="ts">
|
|
97
|
+
* import { useInfiniteQuery } from '@tanstack/vue-query'
|
|
98
|
+
*
|
|
99
|
+
* const {
|
|
100
|
+
* data,
|
|
101
|
+
* isPending,
|
|
102
|
+
* isError,
|
|
103
|
+
* error,
|
|
104
|
+
* fetchNextPage,
|
|
105
|
+
* hasNextPage,
|
|
106
|
+
* isFetching,
|
|
107
|
+
* isFetchingNextPage,
|
|
108
|
+
* } = useInfiniteQuery({
|
|
109
|
+
* queryKey: ['projects'],
|
|
110
|
+
* queryFn: ({ pageParam }) => fetchProjects(pageParam),
|
|
111
|
+
* initialPageParam: 0,
|
|
112
|
+
* getNextPageParam: (lastPage) => lastPage.nextId,
|
|
113
|
+
* })
|
|
114
|
+
* </script>
|
|
115
|
+
*
|
|
116
|
+
* <template>
|
|
117
|
+
* <span v-if="isPending">Loading...</span>
|
|
118
|
+
* <span v-else-if="isError">Error: {{ error.message }}</span>
|
|
119
|
+
* <template v-else>
|
|
120
|
+
* <ul>
|
|
121
|
+
* <template v-for="page in data.pages" :key="page.nextId">
|
|
122
|
+
* <li v-for="project in page.projects" :key="project.id">{{ project.name }}</li>
|
|
123
|
+
* </template>
|
|
124
|
+
* </ul>
|
|
125
|
+
* <button @click="fetchNextPage()" :disabled="!hasNextPage || isFetching">
|
|
126
|
+
* {{ isFetchingNextPage ? 'Loading more...' : hasNextPage ? 'Load More' : 'Nothing more to load' }}
|
|
127
|
+
* </button>
|
|
128
|
+
* </template>
|
|
129
|
+
* </template>
|
|
130
|
+
* ```
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* Fetching the next page automatically as the user scrolls, using an `IntersectionObserver` on a
|
|
134
|
+
* sentinel element after the list:
|
|
135
|
+
* ```vue
|
|
136
|
+
* <script setup lang="ts">
|
|
137
|
+
* import { onUnmounted, ref, watch } from 'vue'
|
|
138
|
+
* import { useInfiniteQuery } from '@tanstack/vue-query'
|
|
139
|
+
*
|
|
140
|
+
* const {
|
|
141
|
+
* data,
|
|
142
|
+
* isPending,
|
|
143
|
+
* isError,
|
|
144
|
+
* error,
|
|
145
|
+
* fetchNextPage,
|
|
146
|
+
* hasNextPage,
|
|
147
|
+
* isFetching,
|
|
148
|
+
* isFetchingNextPage,
|
|
149
|
+
* } = useInfiniteQuery({
|
|
150
|
+
* queryKey: ['projects'],
|
|
151
|
+
* queryFn: ({ pageParam }) => fetchProjects(pageParam),
|
|
152
|
+
* initialPageParam: 0,
|
|
153
|
+
* getNextPageParam: (lastPage) => lastPage.nextId,
|
|
154
|
+
* })
|
|
155
|
+
*
|
|
156
|
+
* const sentinel = ref<HTMLElement>()
|
|
157
|
+
* let observer: IntersectionObserver | undefined
|
|
158
|
+
*
|
|
159
|
+
* watch(sentinel, (el) => {
|
|
160
|
+
* observer?.disconnect()
|
|
161
|
+
* if (el == null) return
|
|
162
|
+
*
|
|
163
|
+
* observer = new IntersectionObserver(([entry]) => {
|
|
164
|
+
* if (entry?.isIntersecting && hasNextPage.value && !isFetching.value) {
|
|
165
|
+
* fetchNextPage()
|
|
166
|
+
* }
|
|
167
|
+
* })
|
|
168
|
+
* observer.observe(el)
|
|
169
|
+
* })
|
|
170
|
+
*
|
|
171
|
+
* onUnmounted(() => observer?.disconnect())
|
|
172
|
+
* </script>
|
|
173
|
+
*
|
|
174
|
+
* <template>
|
|
175
|
+
* <span v-if="isPending">Loading...</span>
|
|
176
|
+
* <span v-else-if="isError">Error: {{ error.message }}</span>
|
|
177
|
+
* <template v-else>
|
|
178
|
+
* <ul>
|
|
179
|
+
* <template v-for="page in data.pages" :key="page.nextId">
|
|
180
|
+
* <li v-for="project in page.projects" :key="project.id">{{ project.name }}</li>
|
|
181
|
+
* </template>
|
|
182
|
+
* </ul>
|
|
183
|
+
* <div ref="sentinel">{{ isFetchingNextPage ? 'Loading more...' : '' }}</div>
|
|
184
|
+
* </template>
|
|
185
|
+
* </template>
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
declare function useInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: MaybeRefOrGetter<UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>>, queryClient?: QueryClient$1): UseInfiniteQueryReturnType<TData, TError>;
|
|
189
|
+
/**
|
|
190
|
+
* Fallback overload for options whose `initialData` presence isn't statically known — for example, a
|
|
191
|
+
* `ref`/reactive object built up conditionally, rather than a plain object literal. Prefer one of the other
|
|
192
|
+
* overloads when possible, since they infer whether `data` can be `undefined` from `initialData` directly.
|
|
193
|
+
*
|
|
194
|
+
* `enabled` tracks reactive dependencies automatically as a `ref`, a plain value, or a reactive getter
|
|
195
|
+
* (`() => ...`). `queryKey` reacts through a `ref` for the array itself, or `ref`s and reactive getters as
|
|
196
|
+
* individual entries — the array itself can't be a bare getter.
|
|
197
|
+
*
|
|
198
|
+
* @param options - A `ref`, plain value, or reactive getter resolving to the {@link UseInfiniteQueryOptions} to
|
|
199
|
+
* use.
|
|
200
|
+
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`
|
|
201
|
+
* will be used.
|
|
202
|
+
* @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,
|
|
203
|
+
* `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`.
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* Passing a whole-options getter so `maxPages` reacts to a setting stored elsewhere, not just `queryKey`:
|
|
207
|
+
* ```vue
|
|
208
|
+
* <script setup lang="ts">
|
|
209
|
+
* import { useInfiniteQuery } from '@tanstack/vue-query'
|
|
210
|
+
*
|
|
211
|
+
* const props = defineProps<{ projectId: number; maxPages: number }>()
|
|
212
|
+
*
|
|
213
|
+
* const { data } = useInfiniteQuery(() => ({
|
|
214
|
+
* queryKey: ['project', props.projectId, 'issues'],
|
|
215
|
+
* queryFn: ({ pageParam }) => fetchIssues(props.projectId, pageParam),
|
|
216
|
+
* initialPageParam: 0,
|
|
217
|
+
* getNextPageParam: (lastPage) => lastPage.nextId,
|
|
218
|
+
* maxPages: props.maxPages,
|
|
219
|
+
* }))
|
|
220
|
+
* </script>
|
|
221
|
+
*
|
|
222
|
+
* <template>
|
|
223
|
+
* <template v-for="page in data?.pages" :key="page.nextId">
|
|
224
|
+
* <li v-for="issue in page.issues" :key="issue.id">{{ issue.title }}</li>
|
|
225
|
+
* </template>
|
|
226
|
+
* </template>
|
|
227
|
+
* ```
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* A query that's disabled, type-safe, until `postId` is set — pass `skipToken` as `queryFn` instead of
|
|
231
|
+
* setting `enabled: false`. This requires a whole-options getter: `queryFn` isn't itself reactive, so the
|
|
232
|
+
* getter is what re-evaluates it on every change to `props.postId`:
|
|
233
|
+
* ```vue
|
|
234
|
+
* <script setup lang="ts">
|
|
235
|
+
* import { skipToken, useInfiniteQuery } from '@tanstack/vue-query'
|
|
236
|
+
*
|
|
237
|
+
* const props = defineProps<{ postId: string | undefined }>()
|
|
238
|
+
*
|
|
239
|
+
* // Use `isLoading`, not `isPending`, so the loading state doesn't show while the query is disabled.
|
|
240
|
+
* const { data, isLoading, isError, error } = useInfiniteQuery(() => {
|
|
241
|
+
* const postId = props.postId
|
|
242
|
+
* return {
|
|
243
|
+
* queryKey: ['post', postId, 'comments'],
|
|
244
|
+
* queryFn:
|
|
245
|
+
* postId != null
|
|
246
|
+
* ? ({ pageParam }) => fetchComments(postId, pageParam)
|
|
247
|
+
* : skipToken,
|
|
248
|
+
* initialPageParam: 0,
|
|
249
|
+
* getNextPageParam: (lastPage) => lastPage.nextId,
|
|
250
|
+
* }
|
|
251
|
+
* })
|
|
252
|
+
* </script>
|
|
253
|
+
*
|
|
254
|
+
* <template>
|
|
255
|
+
* <span v-if="props.postId == null">Select a post</span>
|
|
256
|
+
* <span v-else-if="isLoading">Loading...</span>
|
|
257
|
+
* <span v-else-if="isError">Error: {{ error.message }}</span>
|
|
258
|
+
* <ul v-else>
|
|
259
|
+
* <template v-for="page in data.pages" :key="page.nextId">
|
|
260
|
+
* <li v-for="comment in page.comments" :key="comment.id">{{ comment.text }}</li>
|
|
261
|
+
* </template>
|
|
262
|
+
* </ul>
|
|
263
|
+
* </template>
|
|
264
|
+
* ```
|
|
265
|
+
*/
|
|
266
|
+
declare function useInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: MaybeRefOrGetter<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>>, queryClient?: QueryClient$1): UseInfiniteQueryReturnType<TData, TError>;
|
|
267
|
+
//#endregion
|
|
268
|
+
//#region src/infiniteQueryOptions.d.ts
|
|
269
|
+
/**
|
|
270
|
+
* The options accepted by the `infiniteQueryOptions` overload selected when no `initialData` is set — `data`
|
|
271
|
+
* may be `undefined` while the query is `pending`.
|
|
272
|
+
*
|
|
273
|
+
* @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.
|
|
274
|
+
* @template TError - The type of errors your `queryFn` may throw.
|
|
275
|
+
* @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,
|
|
276
|
+
* the shape of all fetched pages plus their page params.
|
|
277
|
+
* @template TQueryKey - The type of your `queryKey`.
|
|
278
|
+
* @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.
|
|
279
|
+
*/
|
|
280
|
+
type UndefinedInitialDataInfiniteOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & {
|
|
281
|
+
initialData?: undefined;
|
|
282
|
+
};
|
|
283
|
+
/**
|
|
284
|
+
* The options accepted by the `infiniteQueryOptions` overload selected when `initialData` is set — `data` is
|
|
285
|
+
* never `undefined`.
|
|
286
|
+
*
|
|
287
|
+
* @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.
|
|
288
|
+
* @template TError - The type of errors your `queryFn` may throw.
|
|
289
|
+
* @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,
|
|
290
|
+
* the shape of all fetched pages plus their page params.
|
|
291
|
+
* @template TQueryKey - The type of your `queryKey`.
|
|
292
|
+
* @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.
|
|
293
|
+
*/
|
|
294
|
+
type DefinedInitialDataInfiniteOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & {
|
|
295
|
+
/**
|
|
296
|
+
* If set, this value will be used as the initial data for the query cache (as long as the query hasn't been
|
|
297
|
+
* created or cached yet). If set to a function, the function will be called **once** during the shared/root
|
|
298
|
+
* query initialization, and be expected to synchronously return the initial data. Initial data is
|
|
299
|
+
* considered stale by default unless a `staleTime` has been set. `initialData` **is persisted** to the
|
|
300
|
+
* cache.
|
|
301
|
+
*/
|
|
302
|
+
initialData: NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>> | (() => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>);
|
|
303
|
+
};
|
|
304
|
+
/**
|
|
305
|
+
* You can generally pass everything to `infiniteQueryOptions` that you can also pass to `useInfiniteQuery`.
|
|
306
|
+
* These options can be shared across hooks and imperative APIs such as `queryClient.infiniteQuery`.
|
|
307
|
+
* `options.queryKey` is required and is the query key to generate options for.
|
|
308
|
+
*
|
|
309
|
+
* @see {@link useInfiniteQuery} to run an infinite query with these options.
|
|
310
|
+
* @param options - The {@link UndefinedInitialDataInfiniteOptions} to use — everything you can pass to
|
|
311
|
+
* `useInfiniteQuery`.
|
|
312
|
+
* @returns The same options object, typed so that `queryKey` carries the inferred data type.
|
|
313
|
+
*
|
|
314
|
+
* @example
|
|
315
|
+
* ```vue
|
|
316
|
+
* <script setup lang="ts">
|
|
317
|
+
* import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/vue-query'
|
|
318
|
+
*
|
|
319
|
+
* const projectsOptions = infiniteQueryOptions({
|
|
320
|
+
* queryKey: ['projects'],
|
|
321
|
+
* queryFn: ({ pageParam }) => fetchProjects(pageParam),
|
|
322
|
+
* initialPageParam: 0,
|
|
323
|
+
* getNextPageParam: (lastPage) => lastPage.nextId,
|
|
324
|
+
* })
|
|
325
|
+
*
|
|
326
|
+
* const { data, isError, error, fetchNextPage } = useInfiniteQuery(projectsOptions)
|
|
327
|
+
* </script>
|
|
328
|
+
* ```
|
|
329
|
+
*/
|
|
330
|
+
declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>): UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & QueryKeyWithDataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>;
|
|
331
|
+
/**
|
|
332
|
+
* You can generally pass everything to `infiniteQueryOptions` that you can also pass to `useInfiniteQuery`.
|
|
333
|
+
* These options can be shared across hooks and imperative APIs such as `queryClient.infiniteQuery`.
|
|
334
|
+
* `options.queryKey` is required and is the query key to generate options for.
|
|
335
|
+
*
|
|
336
|
+
* This overload is selected when `initialData` is set, so the resulting `data` is never `undefined`.
|
|
337
|
+
*
|
|
338
|
+
* @see {@link useInfiniteQuery} to run an infinite query with these options.
|
|
339
|
+
* @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to
|
|
340
|
+
* `useInfiniteQuery`, with `initialData` set.
|
|
341
|
+
* @returns The same options object, typed so that `queryKey` carries the inferred data type.
|
|
342
|
+
*
|
|
343
|
+
* @example
|
|
344
|
+
* ```vue
|
|
345
|
+
* <script setup lang="ts">
|
|
346
|
+
* import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/vue-query'
|
|
347
|
+
*
|
|
348
|
+
* const projectsOptions = infiniteQueryOptions({
|
|
349
|
+
* queryKey: ['projects'],
|
|
350
|
+
* queryFn: ({ pageParam }) => fetchProjects(pageParam),
|
|
351
|
+
* initialPageParam: 0,
|
|
352
|
+
* getNextPageParam: (lastPage) => lastPage.nextId,
|
|
353
|
+
* initialData: { pages: [], pageParams: [] },
|
|
354
|
+
* })
|
|
355
|
+
*
|
|
356
|
+
* // `data` is never `undefined`, thanks to `initialData` — even if a refetch fails, so the
|
|
357
|
+
* // list stays visible alongside the error.
|
|
358
|
+
* const { data, isError, error } = useInfiniteQuery(projectsOptions)
|
|
359
|
+
* </script>
|
|
360
|
+
* ```
|
|
361
|
+
*/
|
|
362
|
+
declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: DefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>): DefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & QueryKeyWithDataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>;
|
|
363
|
+
//#endregion
|
|
364
|
+
export { UseInfiniteQueryReturnType as a, useBaseQuery as c, UseInfiniteQueryOptions as i, UndefinedInitialDataInfiniteOptions as n, useInfiniteQuery as o, infiniteQueryOptions as r, UseBaseQueryReturnType as s, DefinedInitialDataInfiniteOptions as t };
|
|
365
|
+
//# sourceMappingURL=infiniteQueryOptions-CEDiLwh5.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infiniteQueryOptions-CEDiLwh5.d.ts","names":[],"sources":["../../src/useBaseQuery.ts","../../src/useInfiniteQuery.ts","../../src/infiniteQueryOptions.ts"],"mappings":";;;;;;KA0BY,uBACV,OACA,QACA,UAAU,oBAAoB,OAAO,cAEpC,WAAW,UAAU,8DAIlB,QAAQ,KACR,IAAI,SAAS,SAAS;EAE1B,gBAAgB,QAAQ;;KAGrB,uBACH,cACA,QACA,OACA,YACA,kBAAkB,WAAW,UAC7B,wBAEE,gBAAgB,cAAc,QAAQ,OAAO,YAAY,aACzD,wBAAwB,cAAc,QAAQ,OAAO,WAAW;;;;;;;;;iBAUpD,aACd,cACA,QACA,OACA,YACA,kBAAkB,UAClB,YAEA,iBAAiB,eACjB,SAAS,iBACP,uBACE,cACA,QACA,OACA,YACA,WACA,cAGJ,cAAc,gBACb,uBAAuB,OAAO;;;KCtDrB,wBACV,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,UAC7B,wBACE,YAEC,kBAAkB,6BACjB,cACA,QACA,OACA,WACA,cACE,6BACA,iBACE,6BACE,cACA,QACA,OACA,cAAc,YACd,YACA,aAEJ,aACE,6BACE,cACA,QACA,OACA,cAAc,YACd,YACA,gBAEN;KAGM,2BAA2B,OAAO,UAAU,uBACtD,OACA,QACA,4BAA4B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmDrB,iBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,iBACP,kCACE,cACA,QACA,OACA,WACA,cAGJ,cAAc,gBACb,2BAA2B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqHrB,iBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,iBACP,oCACE,cACA,QACA,OACA,WACA,cAGJ,cAAc,gBACb,2BAA2B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA+ErB,iBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,iBACP,wBAAwB,cAAc,QAAQ,OAAO,WAAW,cAElE,cAAc,gBACb,2BAA2B,OAAO;;;;;;;;;;;;;;KCjVzB,oCACV,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,wBACE,wBACF,cACA,QACA,OACA,WACA;EAEA;;;;;;;;;;;;;KAcU,kCACV,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,wBACE,wBACF,cACA,QACA,OACA,WACA;;;;;;;;EASA,aACI,kBAAkB,aAAa,cAAc,sBACtC,kBAAkB,aAAa,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6B1C,qBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,oCACP,cACA,QACA,OACA,WACA,cAED,oCACD,cACA,QACA,OACA,WACA,cAEA,oBAAoB,WAAW,aAAa,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiC7C,qBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,kCACP,cACA,QACA,OACA,WACA,cAED,kCACD,cACA,QACA,OACA,WACA,cAEA,oBAAoB,WAAW,aAAa,eAAe"}
|