@tanstack/vue-query 5.104.5 → 5.105.1
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.cjs +1 -2
- package/build/legacy/devtools/devtools.d.cts +1 -3
- package/build/legacy/devtools/devtools.d.cts.map +1 -1
- package/build/legacy/devtools/devtools.d.ts +1 -3
- package/build/legacy/devtools/devtools.d.ts.map +1 -1
- package/build/legacy/devtools/devtools.js +1 -2
- package/build/legacy/devtools/utils.cjs +1 -2
- package/build/legacy/devtools/utils.d.cts +0 -2
- package/build/legacy/devtools/utils.d.cts.map +1 -1
- package/build/legacy/devtools/utils.d.ts +0 -2
- package/build/legacy/devtools/utils.d.ts.map +1 -1
- package/build/legacy/devtools/utils.js +1 -2
- package/build/legacy/index.d.cts +4 -4
- package/build/legacy/index.d.ts +4 -4
- package/build/legacy/{infiniteQueryOptions-BaoKhSzb.d.ts → infiniteQueryOptions-BLGtkUwV.d.ts} +28 -33
- package/build/legacy/infiniteQueryOptions-BLGtkUwV.d.ts.map +1 -0
- package/build/legacy/{infiniteQueryOptions-ClNe2-FB.d.cts → infiniteQueryOptions-oStzZOCq.d.cts} +28 -33
- package/build/legacy/infiniteQueryOptions-oStzZOCq.d.cts.map +1 -0
- package/build/legacy/infiniteQueryOptions.cjs +1 -2
- 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 +1 -2
- package/build/legacy/infiniteQueryOptions.js.map +1 -1
- package/build/legacy/mutationCache.cjs +1 -2
- package/build/legacy/mutationCache.d.cts +1 -3
- package/build/legacy/mutationCache.d.cts.map +1 -1
- package/build/legacy/mutationCache.d.ts +1 -3
- package/build/legacy/mutationCache.d.ts.map +1 -1
- package/build/legacy/mutationCache.js +1 -2
- package/build/legacy/mutationOptions.cjs +1 -2
- package/build/legacy/mutationOptions.d.cts +1 -3
- package/build/legacy/mutationOptions.d.cts.map +1 -1
- package/build/legacy/mutationOptions.d.ts +1 -3
- package/build/legacy/mutationOptions.d.ts.map +1 -1
- package/build/legacy/mutationOptions.js +1 -2
- package/build/legacy/queryCache.cjs +1 -2
- package/build/legacy/queryCache.d.cts +1 -3
- package/build/legacy/queryCache.d.cts.map +1 -1
- package/build/legacy/queryCache.d.ts +1 -3
- package/build/legacy/queryCache.d.ts.map +1 -1
- package/build/legacy/queryCache.js +1 -2
- package/build/{modern/queryClient-BoBzDWAZ.d.ts → legacy/queryClient-CVne8UYf.d.ts} +57 -7
- package/build/legacy/queryClient-CVne8UYf.d.ts.map +1 -0
- package/build/{modern/queryClient-BK9W57Qu.d.cts → legacy/queryClient-DdZQqhoA.d.cts} +57 -7
- package/build/legacy/queryClient-DdZQqhoA.d.cts.map +1 -0
- package/build/legacy/queryClient.cjs +1 -2
- 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 +1 -2
- package/build/legacy/queryClient.js.map +1 -1
- package/build/{modern/queryOptions-gpn5D4rf.d.ts → legacy/queryOptions-BuZEBLtg.d.cts} +16 -16
- package/build/legacy/queryOptions-BuZEBLtg.d.cts.map +1 -0
- package/build/{modern/queryOptions-BvmZtmiU.d.cts → legacy/queryOptions-dXiBZnGk.d.ts} +16 -16
- package/build/legacy/queryOptions-dXiBZnGk.d.ts.map +1 -0
- package/build/legacy/queryOptions.cjs +1 -2
- package/build/legacy/queryOptions.cjs.map +1 -1
- package/build/legacy/queryOptions.d.cts +1 -1
- package/build/legacy/queryOptions.d.ts +1 -1
- package/build/legacy/queryOptions.js +1 -2
- package/build/legacy/queryOptions.js.map +1 -1
- package/build/legacy/{types-sdZdiLgo.d.ts → types-u_Tu5Ybs.d.cts} +1 -3
- package/build/legacy/{types-sdZdiLgo.d.ts.map → types-u_Tu5Ybs.d.cts.map} +1 -1
- package/build/{modern/types-sdZdiLgo.d.ts → legacy/types-u_Tu5Ybs.d.ts} +1 -3
- package/build/legacy/types-u_Tu5Ybs.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 +1 -2
- package/build/legacy/useBaseQuery.d.cts +1 -1
- package/build/legacy/useBaseQuery.d.ts +1 -1
- package/build/legacy/useBaseQuery.js +1 -2
- package/build/legacy/useInfiniteQuery.cjs +1 -2
- 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 +1 -2
- package/build/legacy/useInfiniteQuery.js.map +1 -1
- package/build/legacy/useIsFetching.cjs +1 -2
- package/build/legacy/useIsFetching.cjs.map +1 -1
- package/build/legacy/useIsFetching.d.cts +3 -5
- package/build/legacy/useIsFetching.d.cts.map +1 -1
- package/build/legacy/useIsFetching.d.ts +3 -5
- package/build/legacy/useIsFetching.d.ts.map +1 -1
- package/build/legacy/useIsFetching.js +1 -2
- package/build/legacy/useIsFetching.js.map +1 -1
- package/build/legacy/useMutation.cjs +1 -2
- package/build/legacy/useMutation.d.cts +2 -4
- package/build/legacy/useMutation.d.cts.map +1 -1
- package/build/legacy/useMutation.d.ts +2 -4
- package/build/legacy/useMutation.d.ts.map +1 -1
- package/build/legacy/useMutation.js +1 -2
- package/build/legacy/useMutationState.cjs +1 -2
- package/build/legacy/useMutationState.d.cts +2 -4
- package/build/legacy/useMutationState.d.cts.map +1 -1
- package/build/legacy/useMutationState.d.ts +2 -4
- package/build/legacy/useMutationState.d.ts.map +1 -1
- package/build/legacy/useMutationState.js +1 -2
- package/build/legacy/usePrefetchInfiniteQuery.cjs +1 -2
- package/build/legacy/usePrefetchInfiniteQuery.d.cts +2 -4
- package/build/legacy/usePrefetchInfiniteQuery.d.cts.map +1 -1
- package/build/legacy/usePrefetchInfiniteQuery.d.ts +2 -4
- package/build/legacy/usePrefetchInfiniteQuery.d.ts.map +1 -1
- package/build/legacy/usePrefetchInfiniteQuery.js +1 -2
- package/build/legacy/usePrefetchQuery.cjs +1 -2
- package/build/legacy/usePrefetchQuery.d.cts +2 -4
- package/build/legacy/usePrefetchQuery.d.cts.map +1 -1
- package/build/legacy/usePrefetchQuery.d.ts +2 -4
- package/build/legacy/usePrefetchQuery.d.ts.map +1 -1
- package/build/legacy/usePrefetchQuery.js +1 -2
- package/build/legacy/useQueries.cjs +1 -2
- package/build/legacy/useQueries.d.cts +3 -5
- package/build/legacy/useQueries.d.cts.map +1 -1
- package/build/legacy/useQueries.d.ts +3 -5
- package/build/legacy/useQueries.d.ts.map +1 -1
- package/build/legacy/useQueries.js +1 -2
- package/build/legacy/useQuery.cjs +1 -2
- package/build/legacy/useQuery.cjs.map +1 -1
- package/build/legacy/useQuery.d.cts +11 -12
- package/build/legacy/useQuery.d.cts.map +1 -1
- package/build/legacy/useQuery.d.ts +11 -12
- package/build/legacy/useQuery.d.ts.map +1 -1
- package/build/legacy/useQuery.js +1 -2
- package/build/legacy/useQuery.js.map +1 -1
- package/build/legacy/useQueryClient.cjs +1 -2
- package/build/legacy/useQueryClient.d.cts +1 -3
- package/build/legacy/useQueryClient.d.cts.map +1 -1
- package/build/legacy/useQueryClient.d.ts +1 -3
- package/build/legacy/useQueryClient.d.ts.map +1 -1
- package/build/legacy/useQueryClient.js +1 -2
- package/build/legacy/utils.cjs +1 -2
- package/build/legacy/utils.cjs.map +1 -1
- package/build/legacy/utils.d.cts +1 -3
- package/build/legacy/utils.d.cts.map +1 -1
- package/build/legacy/utils.d.ts +1 -3
- package/build/legacy/utils.d.ts.map +1 -1
- package/build/legacy/utils.js +1 -2
- package/build/legacy/utils.js.map +1 -1
- package/build/legacy/vueQueryPlugin.cjs +1 -2
- package/build/legacy/vueQueryPlugin.d.cts +2 -4
- package/build/legacy/vueQueryPlugin.d.cts.map +1 -1
- package/build/legacy/vueQueryPlugin.d.ts +2 -4
- package/build/legacy/vueQueryPlugin.d.ts.map +1 -1
- package/build/legacy/vueQueryPlugin.js +1 -2
- package/build/modern/devtools/devtools.cjs +1 -2
- package/build/modern/devtools/devtools.d.cts +1 -3
- package/build/modern/devtools/devtools.d.cts.map +1 -1
- package/build/modern/devtools/devtools.d.ts +1 -3
- package/build/modern/devtools/devtools.d.ts.map +1 -1
- package/build/modern/devtools/devtools.js +1 -2
- package/build/modern/devtools/utils.cjs +1 -2
- package/build/modern/devtools/utils.d.cts +0 -2
- package/build/modern/devtools/utils.d.cts.map +1 -1
- package/build/modern/devtools/utils.d.ts +0 -2
- package/build/modern/devtools/utils.d.ts.map +1 -1
- package/build/modern/devtools/utils.js +1 -2
- package/build/modern/index.d.cts +4 -4
- package/build/modern/index.d.ts +4 -4
- package/build/modern/{infiniteQueryOptions-BaoKhSzb.d.ts → infiniteQueryOptions-BLGtkUwV.d.ts} +28 -33
- package/build/modern/infiniteQueryOptions-BLGtkUwV.d.ts.map +1 -0
- package/build/modern/{infiniteQueryOptions-ClNe2-FB.d.cts → infiniteQueryOptions-oStzZOCq.d.cts} +28 -33
- package/build/modern/infiniteQueryOptions-oStzZOCq.d.cts.map +1 -0
- package/build/modern/infiniteQueryOptions.cjs +1 -2
- 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 +1 -2
- package/build/modern/infiniteQueryOptions.js.map +1 -1
- package/build/modern/mutationCache.cjs +1 -2
- package/build/modern/mutationCache.d.cts +1 -3
- package/build/modern/mutationCache.d.cts.map +1 -1
- package/build/modern/mutationCache.d.ts +1 -3
- package/build/modern/mutationCache.d.ts.map +1 -1
- package/build/modern/mutationCache.js +1 -2
- package/build/modern/mutationOptions.cjs +1 -2
- package/build/modern/mutationOptions.d.cts +1 -3
- package/build/modern/mutationOptions.d.cts.map +1 -1
- package/build/modern/mutationOptions.d.ts +1 -3
- package/build/modern/mutationOptions.d.ts.map +1 -1
- package/build/modern/mutationOptions.js +1 -2
- package/build/modern/queryCache.cjs +1 -2
- package/build/modern/queryCache.d.cts +1 -3
- package/build/modern/queryCache.d.cts.map +1 -1
- package/build/modern/queryCache.d.ts +1 -3
- package/build/modern/queryCache.d.ts.map +1 -1
- package/build/modern/queryCache.js +1 -2
- package/build/{legacy/queryClient-BoBzDWAZ.d.ts → modern/queryClient-CVne8UYf.d.ts} +57 -7
- package/build/modern/queryClient-CVne8UYf.d.ts.map +1 -0
- package/build/{legacy/queryClient-BK9W57Qu.d.cts → modern/queryClient-DdZQqhoA.d.cts} +57 -7
- package/build/modern/queryClient-DdZQqhoA.d.cts.map +1 -0
- package/build/modern/queryClient.cjs +1 -2
- 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 +1 -2
- package/build/modern/queryClient.js.map +1 -1
- package/build/{legacy/queryOptions-gpn5D4rf.d.ts → modern/queryOptions-BuZEBLtg.d.cts} +16 -16
- package/build/modern/queryOptions-BuZEBLtg.d.cts.map +1 -0
- package/build/{legacy/queryOptions-BvmZtmiU.d.cts → modern/queryOptions-dXiBZnGk.d.ts} +16 -16
- package/build/modern/queryOptions-dXiBZnGk.d.ts.map +1 -0
- package/build/modern/queryOptions.cjs +1 -2
- package/build/modern/queryOptions.cjs.map +1 -1
- package/build/modern/queryOptions.d.cts +1 -1
- package/build/modern/queryOptions.d.ts +1 -1
- package/build/modern/queryOptions.js +1 -2
- package/build/modern/queryOptions.js.map +1 -1
- package/build/{legacy/types-sdZdiLgo.d.cts → modern/types-u_Tu5Ybs.d.cts} +1 -3
- package/build/modern/{types-sdZdiLgo.d.ts.map → types-u_Tu5Ybs.d.cts.map} +1 -1
- package/build/modern/{types-sdZdiLgo.d.cts → types-u_Tu5Ybs.d.ts} +1 -3
- package/build/modern/types-u_Tu5Ybs.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 +1 -2
- package/build/modern/useBaseQuery.d.cts +1 -1
- package/build/modern/useBaseQuery.d.ts +1 -1
- package/build/modern/useBaseQuery.js +1 -2
- package/build/modern/useInfiniteQuery.cjs +1 -2
- 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 +1 -2
- package/build/modern/useInfiniteQuery.js.map +1 -1
- package/build/modern/useIsFetching.cjs +1 -2
- package/build/modern/useIsFetching.cjs.map +1 -1
- package/build/modern/useIsFetching.d.cts +3 -5
- package/build/modern/useIsFetching.d.cts.map +1 -1
- package/build/modern/useIsFetching.d.ts +3 -5
- package/build/modern/useIsFetching.d.ts.map +1 -1
- package/build/modern/useIsFetching.js +1 -2
- package/build/modern/useIsFetching.js.map +1 -1
- package/build/modern/useMutation.cjs +1 -2
- package/build/modern/useMutation.d.cts +2 -4
- package/build/modern/useMutation.d.cts.map +1 -1
- package/build/modern/useMutation.d.ts +2 -4
- package/build/modern/useMutation.d.ts.map +1 -1
- package/build/modern/useMutation.js +1 -2
- package/build/modern/useMutationState.cjs +1 -2
- package/build/modern/useMutationState.d.cts +2 -4
- package/build/modern/useMutationState.d.cts.map +1 -1
- package/build/modern/useMutationState.d.ts +2 -4
- package/build/modern/useMutationState.d.ts.map +1 -1
- package/build/modern/useMutationState.js +1 -2
- package/build/modern/usePrefetchInfiniteQuery.cjs +1 -2
- package/build/modern/usePrefetchInfiniteQuery.d.cts +2 -4
- package/build/modern/usePrefetchInfiniteQuery.d.cts.map +1 -1
- package/build/modern/usePrefetchInfiniteQuery.d.ts +2 -4
- package/build/modern/usePrefetchInfiniteQuery.d.ts.map +1 -1
- package/build/modern/usePrefetchInfiniteQuery.js +1 -2
- package/build/modern/usePrefetchQuery.cjs +1 -2
- package/build/modern/usePrefetchQuery.d.cts +2 -4
- package/build/modern/usePrefetchQuery.d.cts.map +1 -1
- package/build/modern/usePrefetchQuery.d.ts +2 -4
- package/build/modern/usePrefetchQuery.d.ts.map +1 -1
- package/build/modern/usePrefetchQuery.js +1 -2
- package/build/modern/useQueries.cjs +1 -2
- package/build/modern/useQueries.d.cts +3 -5
- package/build/modern/useQueries.d.cts.map +1 -1
- package/build/modern/useQueries.d.ts +3 -5
- package/build/modern/useQueries.d.ts.map +1 -1
- package/build/modern/useQueries.js +1 -2
- package/build/modern/useQuery.cjs +1 -2
- package/build/modern/useQuery.cjs.map +1 -1
- package/build/modern/useQuery.d.cts +11 -12
- package/build/modern/useQuery.d.cts.map +1 -1
- package/build/modern/useQuery.d.ts +11 -12
- package/build/modern/useQuery.d.ts.map +1 -1
- package/build/modern/useQuery.js +1 -2
- package/build/modern/useQuery.js.map +1 -1
- package/build/modern/useQueryClient.cjs +1 -2
- package/build/modern/useQueryClient.d.cts +1 -3
- package/build/modern/useQueryClient.d.cts.map +1 -1
- package/build/modern/useQueryClient.d.ts +1 -3
- package/build/modern/useQueryClient.d.ts.map +1 -1
- package/build/modern/useQueryClient.js +1 -2
- package/build/modern/utils.cjs +1 -2
- package/build/modern/utils.cjs.map +1 -1
- package/build/modern/utils.d.cts +1 -3
- package/build/modern/utils.d.cts.map +1 -1
- package/build/modern/utils.d.ts +1 -3
- package/build/modern/utils.d.ts.map +1 -1
- package/build/modern/utils.js +1 -2
- package/build/modern/utils.js.map +1 -1
- package/build/modern/vueQueryPlugin.cjs +1 -2
- package/build/modern/vueQueryPlugin.d.cts +2 -4
- package/build/modern/vueQueryPlugin.d.cts.map +1 -1
- package/build/modern/vueQueryPlugin.d.ts +2 -4
- package/build/modern/vueQueryPlugin.d.ts.map +1 -1
- package/build/modern/vueQueryPlugin.js +1 -2
- package/package.json +2 -2
- package/src/infiniteQueryOptions.ts +28 -21
- package/src/queryClient.ts +68 -2
- package/src/queryOptions.ts +14 -12
- package/src/useInfiniteQuery.ts +3 -3
- package/src/useIsFetching.ts +2 -2
- package/src/useQuery.ts +7 -6
- package/src/utils.ts +4 -6
- package/build/legacy/infiniteQueryOptions-BaoKhSzb.d.ts.map +0 -1
- package/build/legacy/infiniteQueryOptions-ClNe2-FB.d.cts.map +0 -1
- package/build/legacy/queryClient-BK9W57Qu.d.cts.map +0 -1
- package/build/legacy/queryClient-BoBzDWAZ.d.ts.map +0 -1
- package/build/legacy/queryOptions-BvmZtmiU.d.cts.map +0 -1
- package/build/legacy/queryOptions-gpn5D4rf.d.ts.map +0 -1
- package/build/legacy/types-sdZdiLgo.d.cts.map +0 -1
- package/build/modern/infiniteQueryOptions-BaoKhSzb.d.ts.map +0 -1
- package/build/modern/infiniteQueryOptions-ClNe2-FB.d.cts.map +0 -1
- package/build/modern/queryClient-BK9W57Qu.d.cts.map +0 -1
- package/build/modern/queryClient-BoBzDWAZ.d.ts.map +0 -1
- package/build/modern/queryOptions-BvmZtmiU.d.cts.map +0 -1
- package/build/modern/queryOptions-gpn5D4rf.d.ts.map +0 -1
- package/build/modern/types-sdZdiLgo.d.cts.map +0 -1
|
@@ -2,7 +2,7 @@ import { cloneDeepUnref, updateState } from "./utils.js";
|
|
|
2
2
|
import { useQueryClient } from "./useQueryClient.js";
|
|
3
3
|
import { shouldThrowError } from "@tanstack/query-core";
|
|
4
4
|
import { computed, getCurrentScope, onScopeDispose, reactive, readonly, shallowReactive, shallowReadonly, toRefs, watch } from "vue-demi";
|
|
5
|
-
|
|
5
|
+
// src/useBaseQuery.ts
|
|
6
6
|
/**
|
|
7
7
|
* Base implementation shared by `useQuery` and `useInfiniteQuery`.
|
|
8
8
|
* @param Observer - The observer class from query-core (`QueryObserver` or `InfiniteQueryObserver`).
|
|
@@ -82,7 +82,6 @@ function useBaseQuery(Observer, options, queryClient) {
|
|
|
82
82
|
object.refetch = refetch;
|
|
83
83
|
return object;
|
|
84
84
|
}
|
|
85
|
-
//#endregion
|
|
86
85
|
export { useBaseQuery };
|
|
87
86
|
|
|
88
87
|
//# sourceMappingURL=useBaseQuery.js.map
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_useBaseQuery = require("./useBaseQuery.cjs");
|
|
3
3
|
let _tanstack_query_core = require("@tanstack/query-core");
|
|
4
|
-
|
|
4
|
+
// src/useInfiniteQuery.ts
|
|
5
5
|
function useInfiniteQuery(options, queryClient) {
|
|
6
6
|
return require_useBaseQuery.useBaseQuery(_tanstack_query_core.InfiniteQueryObserver, options, queryClient);
|
|
7
7
|
}
|
|
8
|
-
//#endregion
|
|
9
8
|
exports.useInfiniteQuery = useInfiniteQuery;
|
|
10
9
|
|
|
11
10
|
//# sourceMappingURL=useInfiniteQuery.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInfiniteQuery.cjs","names":["useBaseQuery","InfiniteQueryObserver"],"sources":["../../src/useInfiniteQuery.ts"],"sourcesContent":["import { InfiniteQueryObserver } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport type {\n DefinedInitialDataInfiniteOptions,\n UndefinedInitialDataInfiniteOptions,\n} from './infiniteQueryOptions'\nimport type {\n DefaultError,\n InfiniteData,\n InfiniteQueryObserverOptions,\n InfiniteQueryObserverResult,\n QueryKey,\n QueryObserver,\n} from '@tanstack/query-core'\n\nimport type { UseBaseQueryReturnType } from './useBaseQuery'\n\nimport type {\n DeepUnwrapRef,\n MaybeRef,\n MaybeRefDeep,\n MaybeRefOrGetter,\n ShallowOption,\n} from './types'\nimport type { QueryClient } from './queryClient'\n\n/**\n * The options accepted by `useInfiniteQuery`. Same as {@link InfiniteQueryObserverOptions} from\n * `@tanstack/query-core`, plus the `shallow` option. Each option except `shallow` can also be a `ref` (and\n * `enabled` a reactive getter).\n */\nexport type UseInfiniteQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = MaybeRef<\n {\n [\n Property in keyof InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >\n ]: Property extends 'enabled'\n ? MaybeRefOrGetter<\n InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n DeepUnwrapRef<TQueryKey>,\n TPageParam\n >[Property]\n >\n : MaybeRefDeep<\n InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n DeepUnwrapRef<TQueryKey>,\n TPageParam\n >[Property]\n >\n } & ShallowOption\n>\n\n/**\n * The result of `useInfiniteQuery`: {@link InfiniteQueryObserverResult} from `@tanstack/query-core`, with\n * its properties wrapped in `Ref`s as in {@link UseBaseQueryReturnType}.\n */\nexport type UseInfiniteQueryReturnType<TData, TError> = UseBaseQueryReturnType<\n TData,\n TError,\n InfiniteQueryObserverResult<TData, TError>\n>\n\n/**\n * The options for `useInfiniteQuery` are identical to `useQuery`, with the addition of\n * `initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`.\n *\n * This overload is selected when `initialData` is set, so the resulting `data` is never `undefined` (unless\n * a `select` changes `TData` to include `undefined`).\n *\n * `enabled` tracks reactive dependencies automatically as a `ref`, a plain value, or a reactive getter\n * (`() => ...`). `queryKey` reacts through a `ref` for the array itself, or `ref`s and reactive getters as\n * individual entries — the array itself can't be a bare getter.\n * @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to\n * `useInfiniteQuery`, with `initialData` set.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`\n * will be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`. `data.value.pages` and\n * `data.value.pageParams` are also added, as long as a `select` doesn't change `TData` away from its default\n * `InfiniteData<TQueryFnData>` shape.\n * @remarks Keep in mind that imperative fetch calls, such as `fetchNextPage`, may interfere with the default\n * refetch behavior, resulting in outdated data. Make sure to call these functions only in response to user\n * actions, or add conditions like `hasNextPage && !isFetching`.\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { useInfiniteQuery } from '@tanstack/vue-query'\n *\n * // `data` is never `undefined`, thanks to `initialData` — even if a refetch fails, so the\n * // list stays visible alongside the error.\n * const { data, isError, error } = useInfiniteQuery({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * initialData: { pages: [], pageParams: [] },\n * })\n * </script>\n *\n * <template>\n * <span v-if=\"isError\">Error: {{ error.message }}</span>\n * <ul>\n * <template v-for=\"page in data.pages\" :key=\"page.nextId\">\n * <li v-for=\"project in page.projects\" :key=\"project.id\">{{ project.name }}</li>\n * </template>\n * </ul>\n * </template>\n * ```\n */\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: MaybeRefOrGetter<\n DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryReturnType<TData, TError>\n\n/**\n * The options for `useInfiniteQuery` are identical to `useQuery`, with the addition of\n * `initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`.\n *\n * `enabled` tracks reactive dependencies automatically as a `ref`, a plain value, or a reactive getter\n * (`() => ...`). `queryKey` reacts through a `ref` for the array itself, or `ref`s and reactive getters as\n * individual entries — the array itself can't be a bare getter.\n * @param options - The {@link UndefinedInitialDataInfiniteOptions} to use — everything you can pass to\n * `useInfiniteQuery`.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`\n * will be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`. `data.value.pages` and\n * `data.value.pageParams` are also added, as long as a `select` doesn't change `TData` away from its default\n * `InfiniteData<TQueryFnData>` shape.\n * @remarks Keep in mind that imperative fetch calls, such as `fetchNextPage`, may interfere with the default\n * refetch behavior, resulting in outdated data. Make sure to call these functions only in response to user\n * actions, or add conditions like `hasNextPage && !isFetching`.\n * @example\n * Fetching the next page from a \"Load More\" button click:\n * ```vue\n * <script setup lang=\"ts\">\n * import { useInfiniteQuery } from '@tanstack/vue-query'\n *\n * const {\n * data,\n * isPending,\n * isError,\n * error,\n * fetchNextPage,\n * hasNextPage,\n * isFetching,\n * isFetchingNextPage,\n * } = useInfiniteQuery({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n * </script>\n *\n * <template>\n * <span v-if=\"isPending\">Loading...</span>\n * <span v-else-if=\"isError\">Error: {{ error.message }}</span>\n * <template v-else>\n * <ul>\n * <template v-for=\"page in data.pages\" :key=\"page.nextId\">\n * <li v-for=\"project in page.projects\" :key=\"project.id\">{{ project.name }}</li>\n * </template>\n * </ul>\n * <button @click=\"fetchNextPage()\" :disabled=\"!hasNextPage || isFetching\">\n * {{ isFetchingNextPage ? 'Loading more...' : hasNextPage ? 'Load More' : 'Nothing more to load' }}\n * </button>\n * </template>\n * </template>\n * ```\n * @example\n * Fetching the next page automatically as the user scrolls, using an `IntersectionObserver` on a\n * sentinel element after the list:\n * ```vue\n * <script setup lang=\"ts\">\n * import { onUnmounted, ref, watch } from 'vue'\n * import { useInfiniteQuery } from '@tanstack/vue-query'\n *\n * const {\n * data,\n * isPending,\n * isError,\n * error,\n * fetchNextPage,\n * hasNextPage,\n * isFetching,\n * isFetchingNextPage,\n * } = useInfiniteQuery({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n *\n * const sentinel = ref<HTMLElement>()\n * let observer: IntersectionObserver | undefined\n *\n * watch(sentinel, (el) => {\n * observer?.disconnect()\n * if (el == null) return\n *\n * observer = new IntersectionObserver(([entry]) => {\n * if (entry?.isIntersecting && hasNextPage.value && !isFetching.value) {\n * fetchNextPage()\n * }\n * })\n * observer.observe(el)\n * })\n *\n * onUnmounted(() => observer?.disconnect())\n * </script>\n *\n * <template>\n * <span v-if=\"isPending\">Loading...</span>\n * <span v-else-if=\"isError\">Error: {{ error.message }}</span>\n * <template v-else>\n * <ul>\n * <template v-for=\"page in data.pages\" :key=\"page.nextId\">\n * <li v-for=\"project in page.projects\" :key=\"project.id\">{{ project.name }}</li>\n * </template>\n * </ul>\n * <div ref=\"sentinel\">{{ isFetchingNextPage ? 'Loading more...' : '' }}</div>\n * </template>\n * </template>\n * ```\n */\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: MaybeRefOrGetter<\n UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryReturnType<TData, TError>\n\n/**\n * Fallback overload for options whose `initialData` presence isn't statically known — for example, a\n * `ref`/reactive object built up conditionally, rather than a plain object literal. Prefer one of the other\n * overloads when possible, since they infer whether `data` can be `undefined` from `initialData` directly.\n *\n * `enabled` tracks reactive dependencies automatically as a `ref`, a plain value, or a reactive getter\n * (`() => ...`). `queryKey` reacts through a `ref` for the array itself, or `ref`s and reactive getters as\n * individual entries — the array itself can't be a bare getter.\n * @param options - A `ref`, plain value, or reactive getter resolving to the {@link UseInfiniteQueryOptions} to\n * use.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`\n * will be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`.\n * @example\n * Passing a whole-options getter so `maxPages` reacts to a setting stored elsewhere, not just `queryKey`:\n * ```vue\n * <script setup lang=\"ts\">\n * import { useInfiniteQuery } from '@tanstack/vue-query'\n *\n * const props = defineProps<{ projectId: number; maxPages: number }>()\n *\n * const { data } = useInfiniteQuery(() => ({\n * queryKey: ['project', props.projectId, 'issues'],\n * queryFn: ({ pageParam }) => fetchIssues(props.projectId, pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * maxPages: props.maxPages,\n * }))\n * </script>\n *\n * <template>\n * <template v-for=\"page in data?.pages\" :key=\"page.nextId\">\n * <li v-for=\"issue in page.issues\" :key=\"issue.id\">{{ issue.title }}</li>\n * </template>\n * </template>\n * ```\n * @example\n * A query that's disabled, type-safe, until `postId` is set — pass `skipToken` as `queryFn` instead of\n * setting `enabled: false`. This requires a whole-options getter: `queryFn` isn't itself reactive, so the\n * getter is what re-evaluates it on every change to `props.postId`:\n * ```vue\n * <script setup lang=\"ts\">\n * import { skipToken, useInfiniteQuery } from '@tanstack/vue-query'\n *\n * const props = defineProps<{ postId: string | undefined }>()\n *\n * // Use `isLoading`, not `isPending`, so the loading state doesn't show while the query is disabled.\n * const { data, isLoading, isError, error } = useInfiniteQuery(() => {\n * const postId = props.postId\n * return {\n * queryKey: ['post', postId, 'comments'],\n * queryFn:\n * postId != null\n * ? ({ pageParam }) => fetchComments(postId, pageParam)\n * : skipToken,\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * }\n * })\n * </script>\n *\n * <template>\n * <span v-if=\"props.postId == null\">Select a post</span>\n * <span v-else-if=\"isLoading\">Loading...</span>\n * <span v-else-if=\"isError\">Error: {{ error.message }}</span>\n * <ul v-else>\n * <template v-for=\"page in data.pages\" :key=\"page.nextId\">\n * <li v-for=\"comment in page.comments\" :key=\"comment.id\">{{ comment.text }}</li>\n * </template>\n * </ul>\n * </template>\n * ```\n */\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: MaybeRefOrGetter<\n UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryReturnType<TData, TError>\n\nexport function useInfiniteQuery(\n options: MaybeRefOrGetter<UseInfiniteQueryOptions>,\n queryClient?: QueryClient,\n) {\n return useBaseQuery(\n InfiniteQueryObserver as typeof QueryObserver,\n options,\n queryClient,\n )\n}\n"],"mappings":";;;;AA2WA,SAAgB,iBACd,SACA,aACA;CACA,OAAOA,qBAAAA,aACLC,qBAAAA,uBACA,SACA,WACF;AACF"}
|
|
1
|
+
{"version":3,"file":"useInfiniteQuery.cjs","names":["useBaseQuery","InfiniteQueryObserver"],"sources":["../../src/useInfiniteQuery.ts"],"sourcesContent":["import { InfiniteQueryObserver } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport type {\n DefinedInitialDataInfiniteOptions,\n UndefinedInitialDataInfiniteOptions,\n} from './infiniteQueryOptions'\nimport type {\n DefaultError,\n InfiniteData,\n InfiniteQueryObserverOptions,\n InfiniteQueryObserverResult,\n QueryKey,\n QueryObserver,\n} from '@tanstack/query-core'\n\nimport type { UseBaseQueryReturnType } from './useBaseQuery'\n\nimport type {\n DeepUnwrapRef,\n MaybeRef,\n MaybeRefDeep,\n MaybeRefOrGetter,\n ShallowOption,\n} from './types'\nimport type { QueryClient } from './queryClient'\n\n/**\n * The options accepted by `useInfiniteQuery`. Same as {@link InfiniteQueryObserverOptions} from\n * `@tanstack/query-core`, plus the `shallow` option. Each option except `shallow` can also be a `ref` (and\n * `enabled` a reactive getter).\n */\nexport type UseInfiniteQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = MaybeRef<\n {\n [\n Property in keyof InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >\n ]: Property extends 'enabled'\n ? MaybeRefOrGetter<\n InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n DeepUnwrapRef<TQueryKey>,\n TPageParam\n >[Property]\n >\n : MaybeRefDeep<\n InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n DeepUnwrapRef<TQueryKey>,\n TPageParam\n >[Property]\n >\n } & ShallowOption\n>\n\n/**\n * The result of `useInfiniteQuery`: {@link InfiniteQueryObserverResult} from `@tanstack/query-core`, with\n * its properties wrapped in `Ref`s as in {@link UseBaseQueryReturnType}.\n */\nexport type UseInfiniteQueryReturnType<TData, TError> = UseBaseQueryReturnType<\n TData,\n TError,\n InfiniteQueryObserverResult<TData, TError>\n>\n\n/**\n * The options for `useInfiniteQuery` are identical to `useQuery`, with the addition of\n * `initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`.\n *\n * This overload is selected when `initialData` is known to be defined, so the resulting `data` is never\n * `undefined` (unless a `select` changes `TData` to include `undefined`).\n *\n * `enabled` tracks reactive dependencies automatically as a `ref`, a plain value, or a reactive getter\n * (`() => ...`). `queryKey` reacts through a `ref` for the array itself, or `ref`s and reactive getters as\n * individual entries — the array itself can't be a bare getter.\n * @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to\n * `useInfiniteQuery`, with `initialData` known to be defined.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`\n * will be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`. `data.value.pages` and\n * `data.value.pageParams` are also added, as long as a `select` doesn't change `TData` away from its default\n * `InfiniteData<TQueryFnData>` shape.\n * @remarks Keep in mind that imperative fetch calls, such as `fetchNextPage`, may interfere with the default\n * refetch behavior, resulting in outdated data. Make sure to call these functions only in response to user\n * actions, or add conditions like `hasNextPage && !isFetching`.\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { useInfiniteQuery } from '@tanstack/vue-query'\n *\n * // `data` is never `undefined`, thanks to `initialData` — even if a refetch fails, so the\n * // list stays visible alongside the error.\n * const { data, isError, error } = useInfiniteQuery({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * initialData: { pages: [], pageParams: [] },\n * })\n * </script>\n *\n * <template>\n * <span v-if=\"isError\">Error: {{ error.message }}</span>\n * <ul>\n * <template v-for=\"page in data.pages\" :key=\"page.nextId\">\n * <li v-for=\"project in page.projects\" :key=\"project.id\">{{ project.name }}</li>\n * </template>\n * </ul>\n * </template>\n * ```\n */\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: MaybeRefOrGetter<\n DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryReturnType<TData, TError>\n\n/**\n * The options for `useInfiniteQuery` are identical to `useQuery`, with the addition of\n * `initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`.\n *\n * `enabled` tracks reactive dependencies automatically as a `ref`, a plain value, or a reactive getter\n * (`() => ...`). `queryKey` reacts through a `ref` for the array itself, or `ref`s and reactive getters as\n * individual entries — the array itself can't be a bare getter.\n * @param options - The {@link UndefinedInitialDataInfiniteOptions} to use — everything you can pass to\n * `useInfiniteQuery`.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`\n * will be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`. `data.value.pages` and\n * `data.value.pageParams` are also added, as long as a `select` doesn't change `TData` away from its default\n * `InfiniteData<TQueryFnData>` shape.\n * @remarks Keep in mind that imperative fetch calls, such as `fetchNextPage`, may interfere with the default\n * refetch behavior, resulting in outdated data. Make sure to call these functions only in response to user\n * actions, or add conditions like `hasNextPage && !isFetching`.\n * @example\n * Fetching the next page from a \"Load More\" button click:\n * ```vue\n * <script setup lang=\"ts\">\n * import { useInfiniteQuery } from '@tanstack/vue-query'\n *\n * const {\n * data,\n * isPending,\n * isError,\n * error,\n * fetchNextPage,\n * hasNextPage,\n * isFetching,\n * isFetchingNextPage,\n * } = useInfiniteQuery({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n * </script>\n *\n * <template>\n * <span v-if=\"isPending\">Loading...</span>\n * <span v-else-if=\"isError\">Error: {{ error.message }}</span>\n * <template v-else>\n * <ul>\n * <template v-for=\"page in data.pages\" :key=\"page.nextId\">\n * <li v-for=\"project in page.projects\" :key=\"project.id\">{{ project.name }}</li>\n * </template>\n * </ul>\n * <button @click=\"fetchNextPage()\" :disabled=\"!hasNextPage || isFetching\">\n * {{ isFetchingNextPage ? 'Loading more...' : hasNextPage ? 'Load More' : 'Nothing more to load' }}\n * </button>\n * </template>\n * </template>\n * ```\n * @example\n * Fetching the next page automatically as the user scrolls, using an `IntersectionObserver` on a\n * sentinel element after the list:\n * ```vue\n * <script setup lang=\"ts\">\n * import { onUnmounted, ref, watch } from 'vue'\n * import { useInfiniteQuery } from '@tanstack/vue-query'\n *\n * const {\n * data,\n * isPending,\n * isError,\n * error,\n * fetchNextPage,\n * hasNextPage,\n * isFetching,\n * isFetchingNextPage,\n * } = useInfiniteQuery({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n *\n * const sentinel = ref<HTMLElement>()\n * let observer: IntersectionObserver | undefined\n *\n * watch(sentinel, (el) => {\n * observer?.disconnect()\n * if (el == null) return\n *\n * observer = new IntersectionObserver(([entry]) => {\n * if (entry?.isIntersecting && hasNextPage.value && !isFetching.value) {\n * fetchNextPage()\n * }\n * })\n * observer.observe(el)\n * })\n *\n * onUnmounted(() => observer?.disconnect())\n * </script>\n *\n * <template>\n * <span v-if=\"isPending\">Loading...</span>\n * <span v-else-if=\"isError\">Error: {{ error.message }}</span>\n * <template v-else>\n * <ul>\n * <template v-for=\"page in data.pages\" :key=\"page.nextId\">\n * <li v-for=\"project in page.projects\" :key=\"project.id\">{{ project.name }}</li>\n * </template>\n * </ul>\n * <div ref=\"sentinel\">{{ isFetchingNextPage ? 'Loading more...' : '' }}</div>\n * </template>\n * </template>\n * ```\n */\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: MaybeRefOrGetter<\n UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryReturnType<TData, TError>\n\n/**\n * Fallback overload for options whose `initialData` presence isn't statically known — for example, a\n * `ref`/reactive object built up conditionally, rather than a plain object literal. Prefer one of the other\n * overloads when possible, since they infer whether `data` can be `undefined` from `initialData` directly.\n *\n * `enabled` tracks reactive dependencies automatically as a `ref`, a plain value, or a reactive getter\n * (`() => ...`). `queryKey` reacts through a `ref` for the array itself, or `ref`s and reactive getters as\n * individual entries — the array itself can't be a bare getter.\n * @param options - A `ref`, plain value, or reactive getter resolving to the {@link UseInfiniteQueryOptions} to\n * use.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`\n * will be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`.\n * @example\n * Passing a whole-options getter so `maxPages` reacts to a setting stored elsewhere, not just `queryKey`:\n * ```vue\n * <script setup lang=\"ts\">\n * import { useInfiniteQuery } from '@tanstack/vue-query'\n *\n * const props = defineProps<{ projectId: number; maxPages: number }>()\n *\n * const { data } = useInfiniteQuery(() => ({\n * queryKey: ['project', props.projectId, 'issues'],\n * queryFn: ({ pageParam }) => fetchIssues(props.projectId, pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * maxPages: props.maxPages,\n * }))\n * </script>\n *\n * <template>\n * <template v-for=\"page in data?.pages\" :key=\"page.nextId\">\n * <li v-for=\"issue in page.issues\" :key=\"issue.id\">{{ issue.title }}</li>\n * </template>\n * </template>\n * ```\n * @example\n * A query that's disabled, type-safe, until `postId` is set — pass `skipToken` as `queryFn` instead of\n * setting `enabled: false`. This requires a whole-options getter: `queryFn` isn't itself reactive, so the\n * getter is what re-evaluates it on every change to `props.postId`:\n * ```vue\n * <script setup lang=\"ts\">\n * import { skipToken, useInfiniteQuery } from '@tanstack/vue-query'\n *\n * const props = defineProps<{ postId: string | undefined }>()\n *\n * // Use `isLoading`, not `isPending`, so the loading state doesn't show while the query is disabled.\n * const { data, isLoading, isError, error } = useInfiniteQuery(() => {\n * const postId = props.postId\n * return {\n * queryKey: ['post', postId, 'comments'],\n * queryFn:\n * postId != null\n * ? ({ pageParam }) => fetchComments(postId, pageParam)\n * : skipToken,\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * }\n * })\n * </script>\n *\n * <template>\n * <span v-if=\"props.postId == null\">Select a post</span>\n * <span v-else-if=\"isLoading\">Loading...</span>\n * <span v-else-if=\"isError\">Error: {{ error.message }}</span>\n * <ul v-else>\n * <template v-for=\"page in data.pages\" :key=\"page.nextId\">\n * <li v-for=\"comment in page.comments\" :key=\"comment.id\">{{ comment.text }}</li>\n * </template>\n * </ul>\n * </template>\n * ```\n */\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: MaybeRefOrGetter<\n UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryReturnType<TData, TError>\n\nexport function useInfiniteQuery(\n options: MaybeRefOrGetter<UseInfiniteQueryOptions>,\n queryClient?: QueryClient,\n) {\n return useBaseQuery(\n InfiniteQueryObserver as typeof QueryObserver,\n options,\n queryClient,\n )\n}\n"],"mappings":";;;;AA2WA,SAAgB,iBACd,SACA,aACA;CACA,OAAOA,qBAAAA,aACLC,qBAAAA,uBACA,SACA,WACF;AACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as UseInfiniteQueryReturnType, i as UseInfiniteQueryOptions, o as useInfiniteQuery } from "./infiniteQueryOptions-
|
|
1
|
+
import { a as UseInfiniteQueryReturnType, i as UseInfiniteQueryOptions, o as useInfiniteQuery } from "./infiniteQueryOptions-oStzZOCq.cjs";
|
|
2
2
|
export { UseInfiniteQueryOptions, UseInfiniteQueryReturnType, useInfiniteQuery };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as UseInfiniteQueryReturnType, i as UseInfiniteQueryOptions, o as useInfiniteQuery } from "./infiniteQueryOptions-
|
|
1
|
+
import { a as UseInfiniteQueryReturnType, i as UseInfiniteQueryOptions, o as useInfiniteQuery } from "./infiniteQueryOptions-BLGtkUwV.js";
|
|
2
2
|
export { UseInfiniteQueryOptions, UseInfiniteQueryReturnType, useInfiniteQuery };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { useBaseQuery } from "./useBaseQuery.js";
|
|
2
2
|
import { InfiniteQueryObserver } from "@tanstack/query-core";
|
|
3
|
-
|
|
3
|
+
// src/useInfiniteQuery.ts
|
|
4
4
|
function useInfiniteQuery(options, queryClient) {
|
|
5
5
|
return useBaseQuery(InfiniteQueryObserver, options, queryClient);
|
|
6
6
|
}
|
|
7
|
-
//#endregion
|
|
8
7
|
export { useInfiniteQuery };
|
|
9
8
|
|
|
10
9
|
//# sourceMappingURL=useInfiniteQuery.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInfiniteQuery.js","names":[],"sources":["../../src/useInfiniteQuery.ts"],"sourcesContent":["import { InfiniteQueryObserver } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport type {\n DefinedInitialDataInfiniteOptions,\n UndefinedInitialDataInfiniteOptions,\n} from './infiniteQueryOptions'\nimport type {\n DefaultError,\n InfiniteData,\n InfiniteQueryObserverOptions,\n InfiniteQueryObserverResult,\n QueryKey,\n QueryObserver,\n} from '@tanstack/query-core'\n\nimport type { UseBaseQueryReturnType } from './useBaseQuery'\n\nimport type {\n DeepUnwrapRef,\n MaybeRef,\n MaybeRefDeep,\n MaybeRefOrGetter,\n ShallowOption,\n} from './types'\nimport type { QueryClient } from './queryClient'\n\n/**\n * The options accepted by `useInfiniteQuery`. Same as {@link InfiniteQueryObserverOptions} from\n * `@tanstack/query-core`, plus the `shallow` option. Each option except `shallow` can also be a `ref` (and\n * `enabled` a reactive getter).\n */\nexport type UseInfiniteQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = MaybeRef<\n {\n [\n Property in keyof InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >\n ]: Property extends 'enabled'\n ? MaybeRefOrGetter<\n InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n DeepUnwrapRef<TQueryKey>,\n TPageParam\n >[Property]\n >\n : MaybeRefDeep<\n InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n DeepUnwrapRef<TQueryKey>,\n TPageParam\n >[Property]\n >\n } & ShallowOption\n>\n\n/**\n * The result of `useInfiniteQuery`: {@link InfiniteQueryObserverResult} from `@tanstack/query-core`, with\n * its properties wrapped in `Ref`s as in {@link UseBaseQueryReturnType}.\n */\nexport type UseInfiniteQueryReturnType<TData, TError> = UseBaseQueryReturnType<\n TData,\n TError,\n InfiniteQueryObserverResult<TData, TError>\n>\n\n/**\n * The options for `useInfiniteQuery` are identical to `useQuery`, with the addition of\n * `initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`.\n *\n * This overload is selected when `initialData` is set, so the resulting `data` is never `undefined` (unless\n * a `select` changes `TData` to include `undefined`).\n *\n * `enabled` tracks reactive dependencies automatically as a `ref`, a plain value, or a reactive getter\n * (`() => ...`). `queryKey` reacts through a `ref` for the array itself, or `ref`s and reactive getters as\n * individual entries — the array itself can't be a bare getter.\n * @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to\n * `useInfiniteQuery`, with `initialData` set.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`\n * will be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`. `data.value.pages` and\n * `data.value.pageParams` are also added, as long as a `select` doesn't change `TData` away from its default\n * `InfiniteData<TQueryFnData>` shape.\n * @remarks Keep in mind that imperative fetch calls, such as `fetchNextPage`, may interfere with the default\n * refetch behavior, resulting in outdated data. Make sure to call these functions only in response to user\n * actions, or add conditions like `hasNextPage && !isFetching`.\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { useInfiniteQuery } from '@tanstack/vue-query'\n *\n * // `data` is never `undefined`, thanks to `initialData` — even if a refetch fails, so the\n * // list stays visible alongside the error.\n * const { data, isError, error } = useInfiniteQuery({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * initialData: { pages: [], pageParams: [] },\n * })\n * </script>\n *\n * <template>\n * <span v-if=\"isError\">Error: {{ error.message }}</span>\n * <ul>\n * <template v-for=\"page in data.pages\" :key=\"page.nextId\">\n * <li v-for=\"project in page.projects\" :key=\"project.id\">{{ project.name }}</li>\n * </template>\n * </ul>\n * </template>\n * ```\n */\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: MaybeRefOrGetter<\n DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryReturnType<TData, TError>\n\n/**\n * The options for `useInfiniteQuery` are identical to `useQuery`, with the addition of\n * `initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`.\n *\n * `enabled` tracks reactive dependencies automatically as a `ref`, a plain value, or a reactive getter\n * (`() => ...`). `queryKey` reacts through a `ref` for the array itself, or `ref`s and reactive getters as\n * individual entries — the array itself can't be a bare getter.\n * @param options - The {@link UndefinedInitialDataInfiniteOptions} to use — everything you can pass to\n * `useInfiniteQuery`.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`\n * will be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`. `data.value.pages` and\n * `data.value.pageParams` are also added, as long as a `select` doesn't change `TData` away from its default\n * `InfiniteData<TQueryFnData>` shape.\n * @remarks Keep in mind that imperative fetch calls, such as `fetchNextPage`, may interfere with the default\n * refetch behavior, resulting in outdated data. Make sure to call these functions only in response to user\n * actions, or add conditions like `hasNextPage && !isFetching`.\n * @example\n * Fetching the next page from a \"Load More\" button click:\n * ```vue\n * <script setup lang=\"ts\">\n * import { useInfiniteQuery } from '@tanstack/vue-query'\n *\n * const {\n * data,\n * isPending,\n * isError,\n * error,\n * fetchNextPage,\n * hasNextPage,\n * isFetching,\n * isFetchingNextPage,\n * } = useInfiniteQuery({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n * </script>\n *\n * <template>\n * <span v-if=\"isPending\">Loading...</span>\n * <span v-else-if=\"isError\">Error: {{ error.message }}</span>\n * <template v-else>\n * <ul>\n * <template v-for=\"page in data.pages\" :key=\"page.nextId\">\n * <li v-for=\"project in page.projects\" :key=\"project.id\">{{ project.name }}</li>\n * </template>\n * </ul>\n * <button @click=\"fetchNextPage()\" :disabled=\"!hasNextPage || isFetching\">\n * {{ isFetchingNextPage ? 'Loading more...' : hasNextPage ? 'Load More' : 'Nothing more to load' }}\n * </button>\n * </template>\n * </template>\n * ```\n * @example\n * Fetching the next page automatically as the user scrolls, using an `IntersectionObserver` on a\n * sentinel element after the list:\n * ```vue\n * <script setup lang=\"ts\">\n * import { onUnmounted, ref, watch } from 'vue'\n * import { useInfiniteQuery } from '@tanstack/vue-query'\n *\n * const {\n * data,\n * isPending,\n * isError,\n * error,\n * fetchNextPage,\n * hasNextPage,\n * isFetching,\n * isFetchingNextPage,\n * } = useInfiniteQuery({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n *\n * const sentinel = ref<HTMLElement>()\n * let observer: IntersectionObserver | undefined\n *\n * watch(sentinel, (el) => {\n * observer?.disconnect()\n * if (el == null) return\n *\n * observer = new IntersectionObserver(([entry]) => {\n * if (entry?.isIntersecting && hasNextPage.value && !isFetching.value) {\n * fetchNextPage()\n * }\n * })\n * observer.observe(el)\n * })\n *\n * onUnmounted(() => observer?.disconnect())\n * </script>\n *\n * <template>\n * <span v-if=\"isPending\">Loading...</span>\n * <span v-else-if=\"isError\">Error: {{ error.message }}</span>\n * <template v-else>\n * <ul>\n * <template v-for=\"page in data.pages\" :key=\"page.nextId\">\n * <li v-for=\"project in page.projects\" :key=\"project.id\">{{ project.name }}</li>\n * </template>\n * </ul>\n * <div ref=\"sentinel\">{{ isFetchingNextPage ? 'Loading more...' : '' }}</div>\n * </template>\n * </template>\n * ```\n */\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: MaybeRefOrGetter<\n UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryReturnType<TData, TError>\n\n/**\n * Fallback overload for options whose `initialData` presence isn't statically known — for example, a\n * `ref`/reactive object built up conditionally, rather than a plain object literal. Prefer one of the other\n * overloads when possible, since they infer whether `data` can be `undefined` from `initialData` directly.\n *\n * `enabled` tracks reactive dependencies automatically as a `ref`, a plain value, or a reactive getter\n * (`() => ...`). `queryKey` reacts through a `ref` for the array itself, or `ref`s and reactive getters as\n * individual entries — the array itself can't be a bare getter.\n * @param options - A `ref`, plain value, or reactive getter resolving to the {@link UseInfiniteQueryOptions} to\n * use.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`\n * will be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`.\n * @example\n * Passing a whole-options getter so `maxPages` reacts to a setting stored elsewhere, not just `queryKey`:\n * ```vue\n * <script setup lang=\"ts\">\n * import { useInfiniteQuery } from '@tanstack/vue-query'\n *\n * const props = defineProps<{ projectId: number; maxPages: number }>()\n *\n * const { data } = useInfiniteQuery(() => ({\n * queryKey: ['project', props.projectId, 'issues'],\n * queryFn: ({ pageParam }) => fetchIssues(props.projectId, pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * maxPages: props.maxPages,\n * }))\n * </script>\n *\n * <template>\n * <template v-for=\"page in data?.pages\" :key=\"page.nextId\">\n * <li v-for=\"issue in page.issues\" :key=\"issue.id\">{{ issue.title }}</li>\n * </template>\n * </template>\n * ```\n * @example\n * A query that's disabled, type-safe, until `postId` is set — pass `skipToken` as `queryFn` instead of\n * setting `enabled: false`. This requires a whole-options getter: `queryFn` isn't itself reactive, so the\n * getter is what re-evaluates it on every change to `props.postId`:\n * ```vue\n * <script setup lang=\"ts\">\n * import { skipToken, useInfiniteQuery } from '@tanstack/vue-query'\n *\n * const props = defineProps<{ postId: string | undefined }>()\n *\n * // Use `isLoading`, not `isPending`, so the loading state doesn't show while the query is disabled.\n * const { data, isLoading, isError, error } = useInfiniteQuery(() => {\n * const postId = props.postId\n * return {\n * queryKey: ['post', postId, 'comments'],\n * queryFn:\n * postId != null\n * ? ({ pageParam }) => fetchComments(postId, pageParam)\n * : skipToken,\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * }\n * })\n * </script>\n *\n * <template>\n * <span v-if=\"props.postId == null\">Select a post</span>\n * <span v-else-if=\"isLoading\">Loading...</span>\n * <span v-else-if=\"isError\">Error: {{ error.message }}</span>\n * <ul v-else>\n * <template v-for=\"page in data.pages\" :key=\"page.nextId\">\n * <li v-for=\"comment in page.comments\" :key=\"comment.id\">{{ comment.text }}</li>\n * </template>\n * </ul>\n * </template>\n * ```\n */\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: MaybeRefOrGetter<\n UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryReturnType<TData, TError>\n\nexport function useInfiniteQuery(\n options: MaybeRefOrGetter<UseInfiniteQueryOptions>,\n queryClient?: QueryClient,\n) {\n return useBaseQuery(\n InfiniteQueryObserver as typeof QueryObserver,\n options,\n queryClient,\n )\n}\n"],"mappings":";;;AA2WA,SAAgB,iBACd,SACA,aACA;CACA,OAAO,aACL,uBACA,SACA,WACF;AACF"}
|
|
1
|
+
{"version":3,"file":"useInfiniteQuery.js","names":[],"sources":["../../src/useInfiniteQuery.ts"],"sourcesContent":["import { InfiniteQueryObserver } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport type {\n DefinedInitialDataInfiniteOptions,\n UndefinedInitialDataInfiniteOptions,\n} from './infiniteQueryOptions'\nimport type {\n DefaultError,\n InfiniteData,\n InfiniteQueryObserverOptions,\n InfiniteQueryObserverResult,\n QueryKey,\n QueryObserver,\n} from '@tanstack/query-core'\n\nimport type { UseBaseQueryReturnType } from './useBaseQuery'\n\nimport type {\n DeepUnwrapRef,\n MaybeRef,\n MaybeRefDeep,\n MaybeRefOrGetter,\n ShallowOption,\n} from './types'\nimport type { QueryClient } from './queryClient'\n\n/**\n * The options accepted by `useInfiniteQuery`. Same as {@link InfiniteQueryObserverOptions} from\n * `@tanstack/query-core`, plus the `shallow` option. Each option except `shallow` can also be a `ref` (and\n * `enabled` a reactive getter).\n */\nexport type UseInfiniteQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = MaybeRef<\n {\n [\n Property in keyof InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >\n ]: Property extends 'enabled'\n ? MaybeRefOrGetter<\n InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n DeepUnwrapRef<TQueryKey>,\n TPageParam\n >[Property]\n >\n : MaybeRefDeep<\n InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n DeepUnwrapRef<TQueryKey>,\n TPageParam\n >[Property]\n >\n } & ShallowOption\n>\n\n/**\n * The result of `useInfiniteQuery`: {@link InfiniteQueryObserverResult} from `@tanstack/query-core`, with\n * its properties wrapped in `Ref`s as in {@link UseBaseQueryReturnType}.\n */\nexport type UseInfiniteQueryReturnType<TData, TError> = UseBaseQueryReturnType<\n TData,\n TError,\n InfiniteQueryObserverResult<TData, TError>\n>\n\n/**\n * The options for `useInfiniteQuery` are identical to `useQuery`, with the addition of\n * `initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`.\n *\n * This overload is selected when `initialData` is known to be defined, so the resulting `data` is never\n * `undefined` (unless a `select` changes `TData` to include `undefined`).\n *\n * `enabled` tracks reactive dependencies automatically as a `ref`, a plain value, or a reactive getter\n * (`() => ...`). `queryKey` reacts through a `ref` for the array itself, or `ref`s and reactive getters as\n * individual entries — the array itself can't be a bare getter.\n * @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to\n * `useInfiniteQuery`, with `initialData` known to be defined.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`\n * will be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`. `data.value.pages` and\n * `data.value.pageParams` are also added, as long as a `select` doesn't change `TData` away from its default\n * `InfiniteData<TQueryFnData>` shape.\n * @remarks Keep in mind that imperative fetch calls, such as `fetchNextPage`, may interfere with the default\n * refetch behavior, resulting in outdated data. Make sure to call these functions only in response to user\n * actions, or add conditions like `hasNextPage && !isFetching`.\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { useInfiniteQuery } from '@tanstack/vue-query'\n *\n * // `data` is never `undefined`, thanks to `initialData` — even if a refetch fails, so the\n * // list stays visible alongside the error.\n * const { data, isError, error } = useInfiniteQuery({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * initialData: { pages: [], pageParams: [] },\n * })\n * </script>\n *\n * <template>\n * <span v-if=\"isError\">Error: {{ error.message }}</span>\n * <ul>\n * <template v-for=\"page in data.pages\" :key=\"page.nextId\">\n * <li v-for=\"project in page.projects\" :key=\"project.id\">{{ project.name }}</li>\n * </template>\n * </ul>\n * </template>\n * ```\n */\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: MaybeRefOrGetter<\n DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryReturnType<TData, TError>\n\n/**\n * The options for `useInfiniteQuery` are identical to `useQuery`, with the addition of\n * `initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`.\n *\n * `enabled` tracks reactive dependencies automatically as a `ref`, a plain value, or a reactive getter\n * (`() => ...`). `queryKey` reacts through a `ref` for the array itself, or `ref`s and reactive getters as\n * individual entries — the array itself can't be a bare getter.\n * @param options - The {@link UndefinedInitialDataInfiniteOptions} to use — everything you can pass to\n * `useInfiniteQuery`.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`\n * will be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`. `data.value.pages` and\n * `data.value.pageParams` are also added, as long as a `select` doesn't change `TData` away from its default\n * `InfiniteData<TQueryFnData>` shape.\n * @remarks Keep in mind that imperative fetch calls, such as `fetchNextPage`, may interfere with the default\n * refetch behavior, resulting in outdated data. Make sure to call these functions only in response to user\n * actions, or add conditions like `hasNextPage && !isFetching`.\n * @example\n * Fetching the next page from a \"Load More\" button click:\n * ```vue\n * <script setup lang=\"ts\">\n * import { useInfiniteQuery } from '@tanstack/vue-query'\n *\n * const {\n * data,\n * isPending,\n * isError,\n * error,\n * fetchNextPage,\n * hasNextPage,\n * isFetching,\n * isFetchingNextPage,\n * } = useInfiniteQuery({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n * </script>\n *\n * <template>\n * <span v-if=\"isPending\">Loading...</span>\n * <span v-else-if=\"isError\">Error: {{ error.message }}</span>\n * <template v-else>\n * <ul>\n * <template v-for=\"page in data.pages\" :key=\"page.nextId\">\n * <li v-for=\"project in page.projects\" :key=\"project.id\">{{ project.name }}</li>\n * </template>\n * </ul>\n * <button @click=\"fetchNextPage()\" :disabled=\"!hasNextPage || isFetching\">\n * {{ isFetchingNextPage ? 'Loading more...' : hasNextPage ? 'Load More' : 'Nothing more to load' }}\n * </button>\n * </template>\n * </template>\n * ```\n * @example\n * Fetching the next page automatically as the user scrolls, using an `IntersectionObserver` on a\n * sentinel element after the list:\n * ```vue\n * <script setup lang=\"ts\">\n * import { onUnmounted, ref, watch } from 'vue'\n * import { useInfiniteQuery } from '@tanstack/vue-query'\n *\n * const {\n * data,\n * isPending,\n * isError,\n * error,\n * fetchNextPage,\n * hasNextPage,\n * isFetching,\n * isFetchingNextPage,\n * } = useInfiniteQuery({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n *\n * const sentinel = ref<HTMLElement>()\n * let observer: IntersectionObserver | undefined\n *\n * watch(sentinel, (el) => {\n * observer?.disconnect()\n * if (el == null) return\n *\n * observer = new IntersectionObserver(([entry]) => {\n * if (entry?.isIntersecting && hasNextPage.value && !isFetching.value) {\n * fetchNextPage()\n * }\n * })\n * observer.observe(el)\n * })\n *\n * onUnmounted(() => observer?.disconnect())\n * </script>\n *\n * <template>\n * <span v-if=\"isPending\">Loading...</span>\n * <span v-else-if=\"isError\">Error: {{ error.message }}</span>\n * <template v-else>\n * <ul>\n * <template v-for=\"page in data.pages\" :key=\"page.nextId\">\n * <li v-for=\"project in page.projects\" :key=\"project.id\">{{ project.name }}</li>\n * </template>\n * </ul>\n * <div ref=\"sentinel\">{{ isFetchingNextPage ? 'Loading more...' : '' }}</div>\n * </template>\n * </template>\n * ```\n */\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: MaybeRefOrGetter<\n UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryReturnType<TData, TError>\n\n/**\n * Fallback overload for options whose `initialData` presence isn't statically known — for example, a\n * `ref`/reactive object built up conditionally, rather than a plain object literal. Prefer one of the other\n * overloads when possible, since they infer whether `data` can be `undefined` from `initialData` directly.\n *\n * `enabled` tracks reactive dependencies automatically as a `ref`, a plain value, or a reactive getter\n * (`() => ...`). `queryKey` reacts through a `ref` for the array itself, or `ref`s and reactive getters as\n * individual entries — the array itself can't be a bare getter.\n * @param options - A `ref`, plain value, or reactive getter resolving to the {@link UseInfiniteQueryOptions} to\n * use.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`\n * will be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`.\n * @example\n * Passing a whole-options getter so `maxPages` reacts to a setting stored elsewhere, not just `queryKey`:\n * ```vue\n * <script setup lang=\"ts\">\n * import { useInfiniteQuery } from '@tanstack/vue-query'\n *\n * const props = defineProps<{ projectId: number; maxPages: number }>()\n *\n * const { data } = useInfiniteQuery(() => ({\n * queryKey: ['project', props.projectId, 'issues'],\n * queryFn: ({ pageParam }) => fetchIssues(props.projectId, pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * maxPages: props.maxPages,\n * }))\n * </script>\n *\n * <template>\n * <template v-for=\"page in data?.pages\" :key=\"page.nextId\">\n * <li v-for=\"issue in page.issues\" :key=\"issue.id\">{{ issue.title }}</li>\n * </template>\n * </template>\n * ```\n * @example\n * A query that's disabled, type-safe, until `postId` is set — pass `skipToken` as `queryFn` instead of\n * setting `enabled: false`. This requires a whole-options getter: `queryFn` isn't itself reactive, so the\n * getter is what re-evaluates it on every change to `props.postId`:\n * ```vue\n * <script setup lang=\"ts\">\n * import { skipToken, useInfiniteQuery } from '@tanstack/vue-query'\n *\n * const props = defineProps<{ postId: string | undefined }>()\n *\n * // Use `isLoading`, not `isPending`, so the loading state doesn't show while the query is disabled.\n * const { data, isLoading, isError, error } = useInfiniteQuery(() => {\n * const postId = props.postId\n * return {\n * queryKey: ['post', postId, 'comments'],\n * queryFn:\n * postId != null\n * ? ({ pageParam }) => fetchComments(postId, pageParam)\n * : skipToken,\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * }\n * })\n * </script>\n *\n * <template>\n * <span v-if=\"props.postId == null\">Select a post</span>\n * <span v-else-if=\"isLoading\">Loading...</span>\n * <span v-else-if=\"isError\">Error: {{ error.message }}</span>\n * <ul v-else>\n * <template v-for=\"page in data.pages\" :key=\"page.nextId\">\n * <li v-for=\"comment in page.comments\" :key=\"comment.id\">{{ comment.text }}</li>\n * </template>\n * </ul>\n * </template>\n * ```\n */\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: MaybeRefOrGetter<\n UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryReturnType<TData, TError>\n\nexport function useInfiniteQuery(\n options: MaybeRefOrGetter<UseInfiniteQueryOptions>,\n queryClient?: QueryClient,\n) {\n return useBaseQuery(\n InfiniteQueryObserver as typeof QueryObserver,\n options,\n queryClient,\n )\n}\n"],"mappings":";;;AA2WA,SAAgB,iBACd,SACA,aACA;CACA,OAAO,aACL,uBACA,SACA,WACF;AACF"}
|
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_utils = require("./utils.cjs");
|
|
3
3
|
const require_useQueryClient = require("./useQueryClient.cjs");
|
|
4
4
|
let vue_demi = require("vue-demi");
|
|
5
|
-
|
|
5
|
+
// src/useIsFetching.ts
|
|
6
6
|
/**
|
|
7
7
|
* The `useIsFetching` composable returns a `ref` to the `number` of the queries that your application is
|
|
8
8
|
* loading or fetching in the background (useful for app-wide loading indicators).
|
|
@@ -58,7 +58,6 @@ function useIsFetching(fetchingFilters = {}, queryClient) {
|
|
|
58
58
|
});
|
|
59
59
|
return isFetching;
|
|
60
60
|
}
|
|
61
|
-
//#endregion
|
|
62
61
|
exports.useIsFetching = useIsFetching;
|
|
63
62
|
|
|
64
63
|
//# sourceMappingURL=useIsFetching.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsFetching.cjs","names":["getCurrentScope","useQueryClient","ref","cloneDeepUnref"],"sources":["../../src/useIsFetching.ts"],"sourcesContent":["import { getCurrentScope, onScopeDispose, ref, watchEffect } from 'vue-demi'\nimport { useQueryClient } from './useQueryClient'\nimport { cloneDeepUnref } from './utils'\nimport type { Ref } from 'vue-demi'\nimport type { QueryFilters } from '@tanstack/query-core'\nimport type { MaybeRefDeep } from './types'\nimport type { QueryClient } from './queryClient'\n\n/**\n * The filters accepted by `useIsFetching`: {@link QueryFilters} as a plain object, a `ref`, or a reactive\n * getter.\n */\nexport type UseIsFetchingFilters =\n | MaybeRefDeep<QueryFilters
|
|
1
|
+
{"version":3,"file":"useIsFetching.cjs","names":["getCurrentScope","useQueryClient","ref","cloneDeepUnref"],"sources":["../../src/useIsFetching.ts"],"sourcesContent":["import { getCurrentScope, onScopeDispose, ref, watchEffect } from 'vue-demi'\nimport { useQueryClient } from './useQueryClient'\nimport { cloneDeepUnref } from './utils'\nimport type { Ref } from 'vue-demi'\nimport type { QueryFilters } from '@tanstack/query-core'\nimport type { MaybeRefDeep } from './types'\nimport type { QueryClient } from './queryClient'\n\n/**\n * The filters accepted by `useIsFetching`: {@link QueryFilters} as a plain object, a `ref`, or a reactive\n * getter.\n */\nexport type UseIsFetchingFilters =\n | MaybeRefDeep<Omit<QueryFilters, 'fetchStatus'>>\n | (() => MaybeRefDeep<Omit<QueryFilters, 'fetchStatus'>>)\n\n/**\n * The `useIsFetching` composable returns a `ref` to the `number` of the queries that your application is\n * loading or fetching in the background (useful for app-wide loading indicators).\n *\n * `fetchingFilters` may be a plain object, `MaybeRefDeep`, or a reactive getter (`() => ({ ... })`) — pass a\n * getter if the filters themselves depend on other reactive state.\n * @param fetchingFilters - The {@link QueryFilters} to narrow down the matched queries.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`\n * will be used.\n * @returns A `ref` to the `number` of the queries that your application is currently loading or fetching in\n * the background.\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { useIsFetching } from '@tanstack/vue-query'\n *\n * // How many queries matching the posts prefix are fetching?\n * const isFetchingPosts = useIsFetching({ queryKey: ['posts'] })\n * </script>\n *\n * <template>\n * <span v-if=\"isFetchingPosts\">Refreshing posts...</span>\n * </template>\n * ```\n * @example\n * A global loading indicator for any query fetching in the background, not just the ones on screen:\n * ```vue\n * <script setup lang=\"ts\">\n * import { useIsFetching } from '@tanstack/vue-query'\n *\n * const isFetching = useIsFetching()\n * </script>\n *\n * <template>\n * <div v-if=\"isFetching\">Queries are fetching in the background...</div>\n * </template>\n * ```\n */\nexport function useIsFetching(\n fetchingFilters: UseIsFetchingFilters = {},\n queryClient?: QueryClient,\n): Ref<number> {\n if (process.env.NODE_ENV === 'development') {\n if (!getCurrentScope()) {\n console.warn(\n 'vue-query composable like \"useQuery()\" should only be used inside a \"setup()\" function or a running effect scope. They might otherwise lead to memory leaks.',\n )\n }\n }\n\n const client = queryClient || useQueryClient()\n\n const isFetching = ref()\n\n const listener = () => {\n const resolvedFilters =\n typeof fetchingFilters === 'function'\n ? fetchingFilters()\n : fetchingFilters\n isFetching.value = client.isFetching(cloneDeepUnref(resolvedFilters))\n }\n\n const unsubscribe = client.getQueryCache().subscribe(listener)\n\n watchEffect(listener)\n\n onScopeDispose(() => {\n unsubscribe()\n })\n\n return isFetching\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,SAAgB,cACd,kBAAwC,CAAC,GACzC,aACa;CACb,IAAI,QAAQ,IAAI,aAAa,eACvB;MAAA,EAAA,GAACA,SAAAA,gBAAAA,CAAgB,GACnB,QAAQ,KACN,kKACF;CAAA;CAIJ,MAAM,SAAS,eAAeC,uBAAAA,eAAe;CAE7C,MAAM,cAAA,GAAaC,SAAAA,IAAAA,CAAI;CAEvB,MAAM,iBAAiB;EACrB,MAAM,kBACJ,OAAO,oBAAoB,aACvB,gBAAgB,IAChB;EACN,WAAW,QAAQ,OAAO,WAAWC,cAAAA,eAAe,eAAe,CAAC;CACtE;CAEA,MAAM,cAAc,OAAO,cAAc,CAAC,CAAC,UAAU,QAAQ;CAE7D,CAAA,GAAA,SAAA,YAAA,CAAY,QAAQ;CAEpB,CAAA,GAAA,SAAA,eAAA,OAAqB;EACnB,YAAY;CACd,CAAC;CAED,OAAO;AACT"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { o as MaybeRefDeep } from "./types-
|
|
2
|
-
import { t as QueryClient$1 } from "./queryClient-
|
|
1
|
+
import { o as MaybeRefDeep } from "./types-u_Tu5Ybs.cjs";
|
|
2
|
+
import { t as QueryClient$1 } from "./queryClient-DdZQqhoA.cjs";
|
|
3
3
|
import { QueryFilters } from "@tanstack/query-core";
|
|
4
4
|
import { Ref } from "vue-demi";
|
|
5
|
-
//#region src/useIsFetching.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* The filters accepted by `useIsFetching`: {@link QueryFilters} as a plain object, a `ref`, or a reactive
|
|
8
7
|
* getter.
|
|
9
8
|
*/
|
|
10
|
-
export type UseIsFetchingFilters = MaybeRefDeep<QueryFilters
|
|
9
|
+
export type UseIsFetchingFilters = MaybeRefDeep<Omit<QueryFilters, 'fetchStatus'>> | (() => MaybeRefDeep<Omit<QueryFilters, 'fetchStatus'>>);
|
|
11
10
|
/**
|
|
12
11
|
* The `useIsFetching` composable returns a `ref` to the `number` of the queries that your application is
|
|
13
12
|
* loading or fetching in the background (useful for app-wide loading indicators).
|
|
@@ -47,5 +46,4 @@ export type UseIsFetchingFilters = MaybeRefDeep<QueryFilters> | (() => MaybeRefD
|
|
|
47
46
|
* ```
|
|
48
47
|
*/
|
|
49
48
|
export declare function useIsFetching(fetchingFilters?: UseIsFetchingFilters, queryClient?: QueryClient$1): Ref<number>;
|
|
50
|
-
//#endregion
|
|
51
49
|
//# sourceMappingURL=useIsFetching.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsFetching.d.cts","names":["QueryClient"],"sources":["../../src/useIsFetching.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useIsFetching.d.cts","names":["QueryClient"],"sources":["../../src/useIsFetching.ts"],"mappings":";;;;;;;;YAYY,uBACR,aAAa,KAAK,uCACX,aAAa,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAwCb,cACd,kBAAiB,sBACjB,cAAcA,gBACb"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { o as MaybeRefDeep } from "./types-
|
|
2
|
-
import { t as QueryClient$1 } from "./queryClient-
|
|
1
|
+
import { o as MaybeRefDeep } from "./types-u_Tu5Ybs.js";
|
|
2
|
+
import { t as QueryClient$1 } from "./queryClient-CVne8UYf.js";
|
|
3
3
|
import { QueryFilters } from "@tanstack/query-core";
|
|
4
4
|
import { Ref } from "vue-demi";
|
|
5
|
-
//#region src/useIsFetching.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* The filters accepted by `useIsFetching`: {@link QueryFilters} as a plain object, a `ref`, or a reactive
|
|
8
7
|
* getter.
|
|
9
8
|
*/
|
|
10
|
-
export type UseIsFetchingFilters = MaybeRefDeep<QueryFilters
|
|
9
|
+
export type UseIsFetchingFilters = MaybeRefDeep<Omit<QueryFilters, 'fetchStatus'>> | (() => MaybeRefDeep<Omit<QueryFilters, 'fetchStatus'>>);
|
|
11
10
|
/**
|
|
12
11
|
* The `useIsFetching` composable returns a `ref` to the `number` of the queries that your application is
|
|
13
12
|
* loading or fetching in the background (useful for app-wide loading indicators).
|
|
@@ -47,5 +46,4 @@ export type UseIsFetchingFilters = MaybeRefDeep<QueryFilters> | (() => MaybeRefD
|
|
|
47
46
|
* ```
|
|
48
47
|
*/
|
|
49
48
|
export declare function useIsFetching(fetchingFilters?: UseIsFetchingFilters, queryClient?: QueryClient$1): Ref<number>;
|
|
50
|
-
//#endregion
|
|
51
49
|
//# sourceMappingURL=useIsFetching.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsFetching.d.ts","names":["QueryClient"],"sources":["../../src/useIsFetching.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useIsFetching.d.ts","names":["QueryClient"],"sources":["../../src/useIsFetching.ts"],"mappings":";;;;;;;;YAYY,uBACR,aAAa,KAAK,uCACX,aAAa,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAwCb,cACd,kBAAiB,sBACjB,cAAcA,gBACb"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cloneDeepUnref } from "./utils.js";
|
|
2
2
|
import { useQueryClient } from "./useQueryClient.js";
|
|
3
3
|
import { getCurrentScope, onScopeDispose, ref, watchEffect } from "vue-demi";
|
|
4
|
-
|
|
4
|
+
// src/useIsFetching.ts
|
|
5
5
|
/**
|
|
6
6
|
* The `useIsFetching` composable returns a `ref` to the `number` of the queries that your application is
|
|
7
7
|
* loading or fetching in the background (useful for app-wide loading indicators).
|
|
@@ -57,7 +57,6 @@ function useIsFetching(fetchingFilters = {}, queryClient) {
|
|
|
57
57
|
});
|
|
58
58
|
return isFetching;
|
|
59
59
|
}
|
|
60
|
-
//#endregion
|
|
61
60
|
export { useIsFetching };
|
|
62
61
|
|
|
63
62
|
//# sourceMappingURL=useIsFetching.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsFetching.js","names":[],"sources":["../../src/useIsFetching.ts"],"sourcesContent":["import { getCurrentScope, onScopeDispose, ref, watchEffect } from 'vue-demi'\nimport { useQueryClient } from './useQueryClient'\nimport { cloneDeepUnref } from './utils'\nimport type { Ref } from 'vue-demi'\nimport type { QueryFilters } from '@tanstack/query-core'\nimport type { MaybeRefDeep } from './types'\nimport type { QueryClient } from './queryClient'\n\n/**\n * The filters accepted by `useIsFetching`: {@link QueryFilters} as a plain object, a `ref`, or a reactive\n * getter.\n */\nexport type UseIsFetchingFilters =\n | MaybeRefDeep<QueryFilters
|
|
1
|
+
{"version":3,"file":"useIsFetching.js","names":[],"sources":["../../src/useIsFetching.ts"],"sourcesContent":["import { getCurrentScope, onScopeDispose, ref, watchEffect } from 'vue-demi'\nimport { useQueryClient } from './useQueryClient'\nimport { cloneDeepUnref } from './utils'\nimport type { Ref } from 'vue-demi'\nimport type { QueryFilters } from '@tanstack/query-core'\nimport type { MaybeRefDeep } from './types'\nimport type { QueryClient } from './queryClient'\n\n/**\n * The filters accepted by `useIsFetching`: {@link QueryFilters} as a plain object, a `ref`, or a reactive\n * getter.\n */\nexport type UseIsFetchingFilters =\n | MaybeRefDeep<Omit<QueryFilters, 'fetchStatus'>>\n | (() => MaybeRefDeep<Omit<QueryFilters, 'fetchStatus'>>)\n\n/**\n * The `useIsFetching` composable returns a `ref` to the `number` of the queries that your application is\n * loading or fetching in the background (useful for app-wide loading indicators).\n *\n * `fetchingFilters` may be a plain object, `MaybeRefDeep`, or a reactive getter (`() => ({ ... })`) — pass a\n * getter if the filters themselves depend on other reactive state.\n * @param fetchingFilters - The {@link QueryFilters} to narrow down the matched queries.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`\n * will be used.\n * @returns A `ref` to the `number` of the queries that your application is currently loading or fetching in\n * the background.\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { useIsFetching } from '@tanstack/vue-query'\n *\n * // How many queries matching the posts prefix are fetching?\n * const isFetchingPosts = useIsFetching({ queryKey: ['posts'] })\n * </script>\n *\n * <template>\n * <span v-if=\"isFetchingPosts\">Refreshing posts...</span>\n * </template>\n * ```\n * @example\n * A global loading indicator for any query fetching in the background, not just the ones on screen:\n * ```vue\n * <script setup lang=\"ts\">\n * import { useIsFetching } from '@tanstack/vue-query'\n *\n * const isFetching = useIsFetching()\n * </script>\n *\n * <template>\n * <div v-if=\"isFetching\">Queries are fetching in the background...</div>\n * </template>\n * ```\n */\nexport function useIsFetching(\n fetchingFilters: UseIsFetchingFilters = {},\n queryClient?: QueryClient,\n): Ref<number> {\n if (process.env.NODE_ENV === 'development') {\n if (!getCurrentScope()) {\n console.warn(\n 'vue-query composable like \"useQuery()\" should only be used inside a \"setup()\" function or a running effect scope. They might otherwise lead to memory leaks.',\n )\n }\n }\n\n const client = queryClient || useQueryClient()\n\n const isFetching = ref()\n\n const listener = () => {\n const resolvedFilters =\n typeof fetchingFilters === 'function'\n ? fetchingFilters()\n : fetchingFilters\n isFetching.value = client.isFetching(cloneDeepUnref(resolvedFilters))\n }\n\n const unsubscribe = client.getQueryCache().subscribe(listener)\n\n watchEffect(listener)\n\n onScopeDispose(() => {\n unsubscribe()\n })\n\n return isFetching\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,SAAgB,cACd,kBAAwC,CAAC,GACzC,aACa;CACb,IAAI,QAAQ,IAAI,aAAa,eACvB;MAAA,CAAC,gBAAgB,GACnB,QAAQ,KACN,kKACF;CAAA;CAIJ,MAAM,SAAS,eAAe,eAAe;CAE7C,MAAM,aAAa,IAAI;CAEvB,MAAM,iBAAiB;EACrB,MAAM,kBACJ,OAAO,oBAAoB,aACvB,gBAAgB,IAChB;EACN,WAAW,QAAQ,OAAO,WAAW,eAAe,eAAe,CAAC;CACtE;CAEA,MAAM,cAAc,OAAO,cAAc,CAAC,CAAC,UAAU,QAAQ;CAE7D,YAAY,QAAQ;CAEpB,qBAAqB;EACnB,YAAY;CACd,CAAC;CAED,OAAO;AACT"}
|
|
@@ -3,7 +3,7 @@ const require_utils = require("./utils.cjs");
|
|
|
3
3
|
const require_useQueryClient = require("./useQueryClient.cjs");
|
|
4
4
|
let _tanstack_query_core = require("@tanstack/query-core");
|
|
5
5
|
let vue_demi = require("vue-demi");
|
|
6
|
-
|
|
6
|
+
// src/useMutation.ts
|
|
7
7
|
/**
|
|
8
8
|
* Unlike queries, mutations are typically used to create/update/delete data or perform server side-effects.
|
|
9
9
|
* `useMutation` is the composable for that.
|
|
@@ -194,7 +194,6 @@ function useMutation(options, queryClient) {
|
|
|
194
194
|
reset: state.reset
|
|
195
195
|
};
|
|
196
196
|
}
|
|
197
|
-
//#endregion
|
|
198
197
|
exports.useMutation = useMutation;
|
|
199
198
|
|
|
200
199
|
//# sourceMappingURL=useMutation.cjs.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { c as MutationOptions, o as MaybeRefDeep } from "./types-
|
|
2
|
-
import { t as QueryClient$1 } from "./queryClient-
|
|
1
|
+
import { c as MutationOptions, o as MaybeRefDeep } from "./types-u_Tu5Ybs.cjs";
|
|
2
|
+
import { t as QueryClient$1 } from "./queryClient-DdZQqhoA.cjs";
|
|
3
3
|
import { DefaultError, DistributiveOmit, MutateFunction, MutationObserverResult } from "@tanstack/query-core";
|
|
4
4
|
import { ToRefs } from "vue-demi";
|
|
5
|
-
//#region src/useMutation.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* The {@link MutationObserverResult} properties without `mutate` and `reset`, which `useMutation` replaces with
|
|
8
7
|
* its own versions.
|
|
@@ -179,5 +178,4 @@ export type UseMutationReturnType<TData, TError, TVariables, TOnMutateResult, TR
|
|
|
179
178
|
* ```
|
|
180
179
|
*/
|
|
181
180
|
export declare function useMutation<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown>(options: UseMutationOptions<TData, TError, TVariables, TOnMutateResult>, queryClient?: QueryClient$1): UseMutationReturnType<TData, TError, TVariables, TOnMutateResult>;
|
|
182
|
-
//#endregion
|
|
183
181
|
//# sourceMappingURL=useMutation.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMutation.d.cts","names":["QueryClient"],"sources":["../../src/useMutation.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useMutation.d.cts","names":["QueryClient"],"sources":["../../src/useMutation.ts"],"mappings":";;;;;;;;YA4BY,eAAe,OAAO,QAAQ,YAAY,mBACpD,iBACE,uBAAuB,OAAO,QAAQ,YAAY;;;;;YAQ1C,mBACV,iBACA,SAAS,cACT,mBACA,6BAEE,aAAa,gBAAgB,OAAO,QAAQ,YAAY,2BACjD,aACL,gBAAgB,OAAO,QAAQ,YAAY;KAG5C,mBACH,iBACA,SAAS,cACT,mBACA,iCAEG,SAAS,WACV,eAAe,OAAO,QAAQ,YAAY;;;;;YAQlC,sBACV,OACA,QACA,YACA,iBACA,UAAU,eAAe,OAAO,QAAQ,YAAY,oBAClD,OAAO,SAAS;EAClB,QAAQ,mBAAmB,OAAO,QAAQ,YAAY;EACtD,aAAa,eAAe,OAAO,QAAQ,YAAY;EACvD,OAAO,uBACL,OACA,QACA,YACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA+JY,YACd,iBACA,SAAS,cACT,mBACA,2BAEA,SAAS,mBAAmB,OAAO,QAAQ,YAAY,kBACvD,cAAcA,gBACb,sBAAsB,OAAO,QAAQ,YAAY"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { c as MutationOptions, o as MaybeRefDeep } from "./types-
|
|
2
|
-
import { t as QueryClient$1 } from "./queryClient-
|
|
1
|
+
import { c as MutationOptions, o as MaybeRefDeep } from "./types-u_Tu5Ybs.js";
|
|
2
|
+
import { t as QueryClient$1 } from "./queryClient-CVne8UYf.js";
|
|
3
3
|
import { DefaultError, DistributiveOmit, MutateFunction, MutationObserverResult } from "@tanstack/query-core";
|
|
4
4
|
import { ToRefs } from "vue-demi";
|
|
5
|
-
//#region src/useMutation.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* The {@link MutationObserverResult} properties without `mutate` and `reset`, which `useMutation` replaces with
|
|
8
7
|
* its own versions.
|
|
@@ -179,5 +178,4 @@ export type UseMutationReturnType<TData, TError, TVariables, TOnMutateResult, TR
|
|
|
179
178
|
* ```
|
|
180
179
|
*/
|
|
181
180
|
export declare function useMutation<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown>(options: UseMutationOptions<TData, TError, TVariables, TOnMutateResult>, queryClient?: QueryClient$1): UseMutationReturnType<TData, TError, TVariables, TOnMutateResult>;
|
|
182
|
-
//#endregion
|
|
183
181
|
//# sourceMappingURL=useMutation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMutation.d.ts","names":["QueryClient"],"sources":["../../src/useMutation.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useMutation.d.ts","names":["QueryClient"],"sources":["../../src/useMutation.ts"],"mappings":";;;;;;;;YA4BY,eAAe,OAAO,QAAQ,YAAY,mBACpD,iBACE,uBAAuB,OAAO,QAAQ,YAAY;;;;;YAQ1C,mBACV,iBACA,SAAS,cACT,mBACA,6BAEE,aAAa,gBAAgB,OAAO,QAAQ,YAAY,2BACjD,aACL,gBAAgB,OAAO,QAAQ,YAAY;KAG5C,mBACH,iBACA,SAAS,cACT,mBACA,iCAEG,SAAS,WACV,eAAe,OAAO,QAAQ,YAAY;;;;;YAQlC,sBACV,OACA,QACA,YACA,iBACA,UAAU,eAAe,OAAO,QAAQ,YAAY,oBAClD,OAAO,SAAS;EAClB,QAAQ,mBAAmB,OAAO,QAAQ,YAAY;EACtD,aAAa,eAAe,OAAO,QAAQ,YAAY;EACvD,OAAO,uBACL,OACA,QACA,YACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA+JY,YACd,iBACA,SAAS,cACT,mBACA,2BAEA,SAAS,mBAAmB,OAAO,QAAQ,YAAY,kBACvD,cAAcA,gBACb,sBAAsB,OAAO,QAAQ,YAAY"}
|
|
@@ -2,7 +2,7 @@ import { cloneDeepUnref, updateState } from "./utils.js";
|
|
|
2
2
|
import { useQueryClient } from "./useQueryClient.js";
|
|
3
3
|
import { MutationObserver, shouldThrowError } from "@tanstack/query-core";
|
|
4
4
|
import { computed, getCurrentScope, onScopeDispose, reactive, readonly, shallowReactive, shallowReadonly, toRefs, watch } from "vue-demi";
|
|
5
|
-
|
|
5
|
+
// src/useMutation.ts
|
|
6
6
|
/**
|
|
7
7
|
* Unlike queries, mutations are typically used to create/update/delete data or perform server side-effects.
|
|
8
8
|
* `useMutation` is the composable for that.
|
|
@@ -193,7 +193,6 @@ function useMutation(options, queryClient) {
|
|
|
193
193
|
reset: state.reset
|
|
194
194
|
};
|
|
195
195
|
}
|
|
196
|
-
//#endregion
|
|
197
196
|
export { useMutation };
|
|
198
197
|
|
|
199
198
|
//# sourceMappingURL=useMutation.js.map
|
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_utils = require("./utils.cjs");
|
|
3
3
|
const require_useQueryClient = require("./useQueryClient.cjs");
|
|
4
4
|
let vue_demi = require("vue-demi");
|
|
5
|
-
|
|
5
|
+
// src/useMutationState.ts
|
|
6
6
|
/**
|
|
7
7
|
* The `useIsMutating` composable returns a `ref` to the `number` of mutations that your application currently
|
|
8
8
|
* has `pending` (useful for app-wide loading indicators).
|
|
@@ -142,7 +142,6 @@ function useMutationState(options = {}, queryClient) {
|
|
|
142
142
|
});
|
|
143
143
|
return (0, vue_demi.shallowReadonly)(state);
|
|
144
144
|
}
|
|
145
|
-
//#endregion
|
|
146
145
|
exports.useIsMutating = useIsMutating;
|
|
147
146
|
exports.useMutationState = useMutationState;
|
|
148
147
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { o as MaybeRefDeep } from "./types-
|
|
2
|
-
import { t as QueryClient$1 } from "./queryClient-
|
|
1
|
+
import { o as MaybeRefDeep } from "./types-u_Tu5Ybs.cjs";
|
|
2
|
+
import { t as QueryClient$1 } from "./queryClient-DdZQqhoA.cjs";
|
|
3
3
|
import { Mutation, MutationFilters, MutationState } from "@tanstack/query-core";
|
|
4
4
|
import { Ref } from "vue-demi";
|
|
5
|
-
//#region src/useMutationState.d.ts
|
|
6
5
|
type VueMutationFilters = MaybeRefDeep<MutationFilters>;
|
|
7
6
|
/**
|
|
8
7
|
* The filters accepted by `useIsMutating`: {@link MutationFilters} as a plain object, a `ref`, or a reactive
|
|
@@ -123,5 +122,4 @@ export type MutationStateOptions<TResult = MutationState, TMutation extends Muta
|
|
|
123
122
|
* ```
|
|
124
123
|
*/
|
|
125
124
|
export declare function useMutationState<TResult = MutationState, TMutation extends Mutation<any, any, any, any> = MutationTypeFromResult<TResult>>(options?: MutationStateOptions<TResult, TMutation> | (() => MutationStateOptions<TResult, TMutation>), queryClient?: QueryClient$1): Readonly<Ref<Array<TResult>>>;
|
|
126
|
-
//#endregion
|
|
127
125
|
//# sourceMappingURL=useMutationState.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMutationState.d.cts","names":["QueryClient"],"sources":["../../src/useMutationState.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useMutationState.d.cts","names":["QueryClient"],"sources":["../../src/useMutationState.ts"],"mappings":";;;;KAoBK,qBAAqB,aAAa;;;;;YAM3B,uBACR,4BACO;;;;;;;;;;;;;;;;;;;;;;;;;wBA0BK,cACd,UAAS,sBACT,cAAcA,gBACb;KAyBE,uBAAuB,YAAY,kBACtC,oBACQ,aACA,cACA,kBACA,oBAGN,SAAS,OAAO,QAAQ,YAAY,mBACpC;;;;;YAMQ,qBACV,UAAU,eACV,kBAAkB,+BAChB,uBAAuB;;;;EAKzB,UAAU;;;;EAIV,UAAU,UAAU,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAqGpB,iBACd,UAAU,eACV,kBAAkB,+BAChB,uBAAuB,UAEzB,UACI,qBAAqB,SAAS,oBACvB,qBAAqB,SAAS,aACzC,cAAcA,gBACb,SAAS,IAAI,MAAM"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { o as MaybeRefDeep } from "./types-
|
|
2
|
-
import { t as QueryClient$1 } from "./queryClient-
|
|
1
|
+
import { o as MaybeRefDeep } from "./types-u_Tu5Ybs.js";
|
|
2
|
+
import { t as QueryClient$1 } from "./queryClient-CVne8UYf.js";
|
|
3
3
|
import { Mutation, MutationFilters, MutationState } from "@tanstack/query-core";
|
|
4
4
|
import { Ref } from "vue-demi";
|
|
5
|
-
//#region src/useMutationState.d.ts
|
|
6
5
|
type VueMutationFilters = MaybeRefDeep<MutationFilters>;
|
|
7
6
|
/**
|
|
8
7
|
* The filters accepted by `useIsMutating`: {@link MutationFilters} as a plain object, a `ref`, or a reactive
|
|
@@ -123,5 +122,4 @@ export type MutationStateOptions<TResult = MutationState, TMutation extends Muta
|
|
|
123
122
|
* ```
|
|
124
123
|
*/
|
|
125
124
|
export declare function useMutationState<TResult = MutationState, TMutation extends Mutation<any, any, any, any> = MutationTypeFromResult<TResult>>(options?: MutationStateOptions<TResult, TMutation> | (() => MutationStateOptions<TResult, TMutation>), queryClient?: QueryClient$1): Readonly<Ref<Array<TResult>>>;
|
|
126
|
-
//#endregion
|
|
127
125
|
//# sourceMappingURL=useMutationState.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMutationState.d.ts","names":["QueryClient"],"sources":["../../src/useMutationState.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useMutationState.d.ts","names":["QueryClient"],"sources":["../../src/useMutationState.ts"],"mappings":";;;;KAoBK,qBAAqB,aAAa;;;;;YAM3B,uBACR,4BACO;;;;;;;;;;;;;;;;;;;;;;;;;wBA0BK,cACd,UAAS,sBACT,cAAcA,gBACb;KAyBE,uBAAuB,YAAY,kBACtC,oBACQ,aACA,cACA,kBACA,oBAGN,SAAS,OAAO,QAAQ,YAAY,mBACpC;;;;;YAMQ,qBACV,UAAU,eACV,kBAAkB,+BAChB,uBAAuB;;;;EAKzB,UAAU;;;;EAIV,UAAU,UAAU,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAqGpB,iBACd,UAAU,eACV,kBAAkB,+BAChB,uBAAuB,UAEzB,UACI,qBAAqB,SAAS,oBACvB,qBAAqB,SAAS,aACzC,cAAcA,gBACb,SAAS,IAAI,MAAM"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cloneDeepUnref } from "./utils.js";
|
|
2
2
|
import { useQueryClient } from "./useQueryClient.js";
|
|
3
3
|
import { computed, getCurrentScope, onScopeDispose, shallowReadonly, shallowRef, watch } from "vue-demi";
|
|
4
|
-
|
|
4
|
+
// src/useMutationState.ts
|
|
5
5
|
/**
|
|
6
6
|
* The `useIsMutating` composable returns a `ref` to the `number` of mutations that your application currently
|
|
7
7
|
* has `pending` (useful for app-wide loading indicators).
|
|
@@ -141,7 +141,6 @@ function useMutationState(options = {}, queryClient) {
|
|
|
141
141
|
});
|
|
142
142
|
return shallowReadonly(state);
|
|
143
143
|
}
|
|
144
|
-
//#endregion
|
|
145
144
|
export { useIsMutating, useMutationState };
|
|
146
145
|
|
|
147
146
|
//# sourceMappingURL=useMutationState.js.map
|
|
@@ -3,7 +3,7 @@ const require_utils = require("./utils.cjs");
|
|
|
3
3
|
const require_useQueryClient = require("./useQueryClient.cjs");
|
|
4
4
|
let _tanstack_query_core = require("@tanstack/query-core");
|
|
5
5
|
let vue_demi = require("vue-demi");
|
|
6
|
-
|
|
6
|
+
// src/usePrefetchInfiniteQuery.ts
|
|
7
7
|
/**
|
|
8
8
|
* Checks whether an option was passed as a getter function.
|
|
9
9
|
* @param value - The option value.
|
|
@@ -66,7 +66,6 @@ function usePrefetchInfiniteQuery(options, queryClient) {
|
|
|
66
66
|
if (!client.getQueryState(clonedOptions.queryKey)) client.infiniteQuery(clonedOptions).then(_tanstack_query_core.noop).catch(_tanstack_query_core.noop);
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
-
//#endregion
|
|
70
69
|
exports.usePrefetchInfiniteQuery = usePrefetchInfiniteQuery;
|
|
71
70
|
|
|
72
71
|
//# sourceMappingURL=usePrefetchInfiniteQuery.cjs.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { o as MaybeRefDeep, s as MaybeRefOrGetter } from "./types-
|
|
2
|
-
import { t as QueryClient$1 } from "./queryClient-
|
|
1
|
+
import { o as MaybeRefDeep, s as MaybeRefOrGetter } from "./types-u_Tu5Ybs.cjs";
|
|
2
|
+
import { t as QueryClient$1 } from "./queryClient-DdZQqhoA.cjs";
|
|
3
3
|
import { DefaultError, DistributiveOmit, InfiniteData, InfiniteQueryExecuteOptions, QueryKey, SkipToken } from "@tanstack/query-core";
|
|
4
|
-
//#region src/usePrefetchInfiniteQuery.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* The options accepted by `usePrefetchInfiniteQuery` — everything you can pass to `queryClient.infiniteQuery`,
|
|
7
6
|
* except that `queryFn` can't be `skipToken`.
|
|
@@ -53,5 +52,4 @@ export type UsePrefetchInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryK
|
|
|
53
52
|
* ```
|
|
54
53
|
*/
|
|
55
54
|
export declare function usePrefetchInfiniteQuery<TQueryFnData = unknown, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: MaybeRefOrGetter<MaybeRefDeep<UsePrefetchInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>>>, queryClient?: QueryClient$1): void;
|
|
56
|
-
//#endregion
|
|
57
55
|
//# sourceMappingURL=usePrefetchInfiniteQuery.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePrefetchInfiniteQuery.d.cts","names":["QueryClient"],"sources":["../../src/usePrefetchInfiniteQuery.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"usePrefetchInfiniteQuery.d.cts","names":["QueryClient"],"sources":["../../src/usePrefetchInfiniteQuery.ts"],"mappings":";;;;;;;YAmBY,gCACV,cACA,QACA,OACA,kBAAkB,UAClB,cACE,iBACF,4BACE,cACA,QACA,OACA,WACA;EAIF,UAAU,QACR,4BACE,cACA,QACA,OACA,WACA,wBAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAwDY,yBACd,wBACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,iBACP,aACE,gCACE,cACA,QACA,OACA,WACA,eAIN,cAAcA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { o as MaybeRefDeep, s as MaybeRefOrGetter } from "./types-
|
|
2
|
-
import { t as QueryClient$1 } from "./queryClient-
|
|
1
|
+
import { o as MaybeRefDeep, s as MaybeRefOrGetter } from "./types-u_Tu5Ybs.js";
|
|
2
|
+
import { t as QueryClient$1 } from "./queryClient-CVne8UYf.js";
|
|
3
3
|
import { DefaultError, DistributiveOmit, InfiniteData, InfiniteQueryExecuteOptions, QueryKey, SkipToken } from "@tanstack/query-core";
|
|
4
|
-
//#region src/usePrefetchInfiniteQuery.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* The options accepted by `usePrefetchInfiniteQuery` — everything you can pass to `queryClient.infiniteQuery`,
|
|
7
6
|
* except that `queryFn` can't be `skipToken`.
|
|
@@ -53,5 +52,4 @@ export type UsePrefetchInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryK
|
|
|
53
52
|
* ```
|
|
54
53
|
*/
|
|
55
54
|
export declare function usePrefetchInfiniteQuery<TQueryFnData = unknown, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: MaybeRefOrGetter<MaybeRefDeep<UsePrefetchInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>>>, queryClient?: QueryClient$1): void;
|
|
56
|
-
//#endregion
|
|
57
55
|
//# sourceMappingURL=usePrefetchInfiniteQuery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePrefetchInfiniteQuery.d.ts","names":["QueryClient"],"sources":["../../src/usePrefetchInfiniteQuery.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"usePrefetchInfiniteQuery.d.ts","names":["QueryClient"],"sources":["../../src/usePrefetchInfiniteQuery.ts"],"mappings":";;;;;;;YAmBY,gCACV,cACA,QACA,OACA,kBAAkB,UAClB,cACE,iBACF,4BACE,cACA,QACA,OACA,WACA;EAIF,UAAU,QACR,4BACE,cACA,QACA,OACA,WACA,wBAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAwDY,yBACd,wBACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,iBACP,aACE,gCACE,cACA,QACA,OACA,WACA,eAIN,cAAcA"}
|
|
@@ -2,7 +2,7 @@ import { cloneDeepUnref } from "./utils.js";
|
|
|
2
2
|
import { useQueryClient } from "./useQueryClient.js";
|
|
3
3
|
import { noop } from "@tanstack/query-core";
|
|
4
4
|
import { getCurrentScope, unref, watchEffect } from "vue-demi";
|
|
5
|
-
|
|
5
|
+
// src/usePrefetchInfiniteQuery.ts
|
|
6
6
|
/**
|
|
7
7
|
* Checks whether an option was passed as a getter function.
|
|
8
8
|
* @param value - The option value.
|
|
@@ -65,7 +65,6 @@ function usePrefetchInfiniteQuery(options, queryClient) {
|
|
|
65
65
|
if (!client.getQueryState(clonedOptions.queryKey)) client.infiniteQuery(clonedOptions).then(noop).catch(noop);
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
//#endregion
|
|
69
68
|
export { usePrefetchInfiniteQuery };
|
|
70
69
|
|
|
71
70
|
//# sourceMappingURL=usePrefetchInfiniteQuery.js.map
|