@tanstack/vue-query 5.105.0 → 5.105.2
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-BOLnyklt.d.cts → infiniteQueryOptions-394nfvsx.d.cts} +28 -33
- package/build/legacy/infiniteQueryOptions-394nfvsx.d.cts.map +1 -0
- package/build/legacy/{infiniteQueryOptions-CoRGgnPB.d.ts → infiniteQueryOptions-BgppOfVU.d.ts} +28 -33
- package/build/legacy/infiniteQueryOptions-BgppOfVU.d.ts.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-D4OU6h40.d.ts → legacy/queryClient-DnwIQfaz.d.ts} +5 -7
- package/build/legacy/queryClient-DnwIQfaz.d.ts.map +1 -0
- package/build/{modern/queryClient-4Y1X98Y3.d.cts → legacy/queryClient-TRmDxsOf.d.cts} +5 -7
- package/build/legacy/queryClient-TRmDxsOf.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.cjs.map +1 -1
- package/build/legacy/useMutationState.d.cts +3 -5
- package/build/legacy/useMutationState.d.cts.map +1 -1
- package/build/legacy/useMutationState.d.ts +3 -5
- package/build/legacy/useMutationState.d.ts.map +1 -1
- package/build/legacy/useMutationState.js +1 -2
- package/build/legacy/useMutationState.js.map +1 -1
- 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.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/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-BOLnyklt.d.cts → infiniteQueryOptions-394nfvsx.d.cts} +28 -33
- package/build/modern/infiniteQueryOptions-394nfvsx.d.cts.map +1 -0
- package/build/modern/{infiniteQueryOptions-CoRGgnPB.d.ts → infiniteQueryOptions-BgppOfVU.d.ts} +28 -33
- package/build/modern/infiniteQueryOptions-BgppOfVU.d.ts.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-D4OU6h40.d.ts → modern/queryClient-DnwIQfaz.d.ts} +5 -7
- package/build/modern/queryClient-DnwIQfaz.d.ts.map +1 -0
- package/build/{legacy/queryClient-4Y1X98Y3.d.cts → modern/queryClient-TRmDxsOf.d.cts} +5 -7
- package/build/modern/queryClient-TRmDxsOf.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.cjs.map +1 -1
- package/build/modern/useMutationState.d.cts +3 -5
- package/build/modern/useMutationState.d.cts.map +1 -1
- package/build/modern/useMutationState.d.ts +3 -5
- package/build/modern/useMutationState.d.ts.map +1 -1
- package/build/modern/useMutationState.js +1 -2
- package/build/modern/useMutationState.js.map +1 -1
- 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.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/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 +6 -2
- package/src/queryOptions.ts +14 -12
- package/src/useInfiniteQuery.ts +3 -3
- package/src/useIsFetching.ts +2 -2
- package/src/useMutationState.ts +2 -2
- package/src/useQuery.ts +7 -6
- package/build/legacy/infiniteQueryOptions-BOLnyklt.d.cts.map +0 -1
- package/build/legacy/infiniteQueryOptions-CoRGgnPB.d.ts.map +0 -1
- package/build/legacy/queryClient-4Y1X98Y3.d.cts.map +0 -1
- package/build/legacy/queryClient-D4OU6h40.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-BOLnyklt.d.cts.map +0 -1
- package/build/modern/infiniteQueryOptions-CoRGgnPB.d.ts.map +0 -1
- package/build/modern/queryClient-4Y1X98Y3.d.cts.map +0 -1
- package/build/modern/queryClient-D4OU6h40.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
|
@@ -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-394nfvsx.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-BgppOfVU.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-TRmDxsOf.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-DnwIQfaz.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-TRmDxsOf.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-DnwIQfaz.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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMutationState.cjs","names":["getCurrentScope","useQueryClient","computed","cloneDeepUnref","shallowRef","shallowReadonly"],"sources":["../../src/useMutationState.ts"],"sourcesContent":["import {\n computed,\n getCurrentScope,\n onScopeDispose,\n shallowReadonly,\n shallowRef,\n watch,\n} from 'vue-demi'\nimport { useQueryClient } from './useQueryClient'\nimport { cloneDeepUnref } from './utils'\nimport type { Ref } from 'vue-demi'\nimport type {\n Mutation,\n MutationFilters,\n MutationState,\n} from '@tanstack/query-core'\nimport type { QueryClient } from './queryClient'\nimport type { MaybeRefDeep } from './types'\nimport type { MutationCache } from './mutationCache'\n\ntype VueMutationFilters = MaybeRefDeep<MutationFilters>\n\n/**\n * The filters accepted by `useIsMutating`: {@link MutationFilters} as a plain object, a `ref`, or a reactive\n * getter.\n */\nexport type UseIsMutatingFilters =\n |
|
|
1
|
+
{"version":3,"file":"useMutationState.cjs","names":["getCurrentScope","useQueryClient","computed","cloneDeepUnref","shallowRef","shallowReadonly"],"sources":["../../src/useMutationState.ts"],"sourcesContent":["import {\n computed,\n getCurrentScope,\n onScopeDispose,\n shallowReadonly,\n shallowRef,\n watch,\n} from 'vue-demi'\nimport { useQueryClient } from './useQueryClient'\nimport { cloneDeepUnref } from './utils'\nimport type { Ref } from 'vue-demi'\nimport type {\n Mutation,\n MutationFilters,\n MutationState,\n} from '@tanstack/query-core'\nimport type { QueryClient } from './queryClient'\nimport type { MaybeRefDeep } from './types'\nimport type { MutationCache } from './mutationCache'\n\ntype VueMutationFilters = MaybeRefDeep<MutationFilters>\n\n/**\n * The filters accepted by `useIsMutating`: {@link MutationFilters} as a plain object, a `ref`, or a reactive\n * getter.\n */\nexport type UseIsMutatingFilters =\n | MaybeRefDeep<Omit<MutationFilters, 'status'>>\n | (() => MaybeRefDeep<Omit<MutationFilters, 'status'>>)\n\n/**\n * The `useIsMutating` composable returns a `ref` to the `number` of mutations that your application currently\n * has `pending` (useful for app-wide loading indicators).\n *\n * `filters` may be a plain object, `MaybeRefDeep`, or a reactive getter (`() => ({ ... })`) — pass a getter if\n * the filters themselves depend on other reactive state.\n * @param filters - The {@link MutationFilters} to narrow down the matched mutations.\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 mutations that your application currently has `pending`.\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { useIsMutating } from '@tanstack/vue-query'\n *\n * // How many mutations matching the posts prefix are in progress?\n * const isMutatingPosts = useIsMutating({ mutationKey: ['posts'] })\n * </script>\n *\n * <template>\n * <span v-if=\"isMutatingPosts\">Saving posts...</span>\n * </template>\n * ```\n */\nexport function useIsMutating(\n filters: UseIsMutatingFilters = {},\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 mutationState = useMutationState(\n {\n filters: computed(() => ({\n ...cloneDeepUnref(typeof filters === 'function' ? filters() : filters),\n status: 'pending' as const,\n })),\n },\n client,\n )\n const length = computed(() => mutationState.value.length)\n\n return length\n}\n\ntype MutationTypeFromResult<TResult> = [TResult] extends [\n MutationState<\n infer TData,\n infer TError,\n infer TVariables,\n infer TOnMutateResult\n >,\n]\n ? Mutation<TData, TError, TVariables, TOnMutateResult>\n : Mutation\n\n/**\n * The options accepted by `useMutationState`: the `filters` matching the mutations, and `select` to map each\n * one (to its state, by default).\n */\nexport type MutationStateOptions<\n TResult = MutationState,\n TMutation extends Mutation<any, any, any, any> =\n MutationTypeFromResult<TResult>,\n> = {\n /**\n * The filters that select the mutations to return the state of.\n */\n filters?: VueMutationFilters\n /**\n * Maps each matching mutation to the value returned for it. Defaults to the mutation's `state`.\n */\n select?: (mutation: TMutation) => TResult\n}\n\n/**\n * Collects the mutations in the cache that match `options.filters`, mapped with `options.select`\n * (or to their state, by default).\n * @param mutationCache - The mutation cache to read.\n * @param options - The `filters` to match and the `select` function to map each mutation with.\n * @returns The selected value of every matching mutation.\n */\nfunction getResult<\n TResult = MutationState,\n TMutation extends Mutation<any, any, any, any> =\n MutationTypeFromResult<TResult>,\n>(\n mutationCache: MutationCache,\n options: MutationStateOptions<TResult, TMutation>,\n): Array<TResult> {\n return mutationCache\n .findAll(options.filters)\n .map(\n (mutation): TResult =>\n (options.select\n ? options.select(mutation as TMutation)\n : mutation.state) as TResult,\n )\n}\n\n/**\n * `useMutationState` is a composable that gives you access to all mutations in the `MutationCache`. You can\n * pass `filters` ({@link MutationFilters}) to narrow down your mutations, and `select` to transform the\n * mutation state.\n *\n * `options` may be a plain object or a reactive getter (`() => ({ ... })`) — pass a getter if the filters\n * themselves depend on other reactive state.\n * @param options - The `filters` to narrow down matched mutations, and an optional `select` to transform the\n * mutation state.\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 an Array of whatever `select` returns for each matching mutation.\n * @example\n * Get all variables of all running mutations:\n * ```vue\n * <script setup lang=\"ts\">\n * import { useMutationState } from '@tanstack/vue-query'\n *\n * const pendingVariables = useMutationState({\n * filters: { status: 'pending' },\n * select: (mutation) => mutation.state.variables,\n * })\n * </script>\n *\n * <template>{{ pendingVariables.length }} posts saving...</template>\n * ```\n * @example\n * Get all data for specific mutations via the `mutationKey`:\n * ```vue\n * <script setup lang=\"ts\">\n * import { useMutation, useMutationState } from '@tanstack/vue-query'\n *\n * const mutationKey = ['posts']\n *\n * // Some mutation that we want to get the state for\n * const mutation = useMutation({\n * mutationKey,\n * mutationFn: createPosts,\n * })\n *\n * const savedPosts = useMutationState({\n * // this mutation key needs to match the mutation key of the given mutation (see above)\n * filters: { mutationKey, status: 'success' },\n * select: (mutation) => mutation.state.data,\n * })\n * </script>\n *\n * <template>\n * <button @click=\"mutation.mutate(['New Post'])\">\n * Create post ({{ savedPosts.length }} saved so far)\n * </button>\n * </template>\n * ```\n * @example\n * Access the latest successful mutation data via the `mutationKey`. Each invocation of `mutate` adds a new\n * entry to the mutation cache for `gcTime` milliseconds — with the `status: 'success'` filter below, check the\n * last item that `useMutationState` returns to get the latest successful invocation:\n * ```vue\n * <script setup lang=\"ts\">\n * import { computed } from 'vue'\n * import { useMutationState } from '@tanstack/vue-query'\n *\n * const savedPosts = useMutationState({\n * filters: { mutationKey: ['posts'], status: 'success' },\n * select: (mutation) => mutation.state.data,\n * })\n *\n * const latestSavedPost = computed(() => savedPosts.value[savedPosts.value.length - 1])\n * </script>\n *\n * <template>{{ latestSavedPost ? 'Saved' : 'Nothing saved yet' }}</template>\n * ```\n */\nexport function useMutationState<\n TResult = MutationState,\n TMutation extends Mutation<any, any, any, any> =\n MutationTypeFromResult<TResult>,\n>(\n options:\n | MutationStateOptions<TResult, TMutation>\n | (() => MutationStateOptions<TResult, TMutation>) = {},\n queryClient?: QueryClient,\n): Readonly<Ref<Array<TResult>>> {\n const resolvedOptions = computed(() => {\n const newOptions = typeof options === 'function' ? options() : options\n return {\n filters: cloneDeepUnref(newOptions.filters),\n select: newOptions.select,\n }\n })\n const mutationCache = (queryClient || useQueryClient()).getMutationCache()\n const state = shallowRef(getResult(mutationCache, resolvedOptions.value))\n const unsubscribe = mutationCache.subscribe(() => {\n state.value = getResult(mutationCache, resolvedOptions.value)\n })\n\n watch(resolvedOptions, () => {\n state.value = getResult(mutationCache, resolvedOptions.value)\n })\n\n onScopeDispose(() => {\n unsubscribe()\n })\n\n return shallowReadonly(state)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,SAAgB,cACd,UAAgC,CAAC,GACjC,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,gBAAgB,iBACpB,EACE,UAAA,GAASC,SAAAA,SAAAA,QAAgB;EACvB,GAAGC,cAAAA,eAAe,OAAO,YAAY,aAAa,QAAQ,IAAI,OAAO;EACrE,QAAQ;CACV,EAAE,EACJ,GACA,MACF;CAGA,QAAA,GAFeD,SAAAA,SAAAA,OAAe,cAAc,MAAM,MAEtC;AACd;;;;;;;;AAuCA,SAAS,UAKP,eACA,SACgB;CAChB,OAAO,cACJ,QAAQ,QAAQ,OAAO,CAAC,CACxB,KACE,aACE,QAAQ,SACL,QAAQ,OAAO,QAAqB,IACpC,SAAS,KACjB;AACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2EA,SAAgB,iBAKd,UAEuD,CAAC,GACxD,aAC+B;CAC/B,MAAM,mBAAA,GAAkBA,SAAAA,SAAAA,OAAe;EACrC,MAAM,aAAa,OAAO,YAAY,aAAa,QAAQ,IAAI;EAC/D,OAAO;GACL,SAASC,cAAAA,eAAe,WAAW,OAAO;GAC1C,QAAQ,WAAW;EACrB;CACF,CAAC;CACD,MAAM,iBAAiB,eAAeF,uBAAAA,eAAe,EAAA,CAAG,iBAAiB;CACzE,MAAM,SAAA,GAAQG,SAAAA,WAAAA,CAAW,UAAU,eAAe,gBAAgB,KAAK,CAAC;CACxE,MAAM,cAAc,cAAc,gBAAgB;EAChD,MAAM,QAAQ,UAAU,eAAe,gBAAgB,KAAK;CAC9D,CAAC;CAED,CAAA,GAAA,SAAA,MAAA,CAAM,uBAAuB;EAC3B,MAAM,QAAQ,UAAU,eAAe,gBAAgB,KAAK;CAC9D,CAAC;CAED,CAAA,GAAA,SAAA,eAAA,OAAqB;EACnB,YAAY;CACd,CAAC;CAED,QAAA,GAAOC,SAAAA,gBAAAA,CAAgB,KAAK;AAC9B"}
|
|
@@ -1,14 +1,13 @@
|
|
|
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-TRmDxsOf.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
|
|
9
8
|
* getter.
|
|
10
9
|
*/
|
|
11
|
-
export type UseIsMutatingFilters =
|
|
10
|
+
export type UseIsMutatingFilters = MaybeRefDeep<Omit<MutationFilters, 'status'>> | (() => MaybeRefDeep<Omit<MutationFilters, 'status'>>);
|
|
12
11
|
/**
|
|
13
12
|
* The `useIsMutating` composable returns a `ref` to the `number` of mutations that your application currently
|
|
14
13
|
* has `pending` (useful for app-wide loading indicators).
|
|
@@ -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,aAAa,KAAK,qCACX,aAAa,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;wBA0Bb,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,14 +1,13 @@
|
|
|
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-DnwIQfaz.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
|
|
9
8
|
* getter.
|
|
10
9
|
*/
|
|
11
|
-
export type UseIsMutatingFilters =
|
|
10
|
+
export type UseIsMutatingFilters = MaybeRefDeep<Omit<MutationFilters, 'status'>> | (() => MaybeRefDeep<Omit<MutationFilters, 'status'>>);
|
|
12
11
|
/**
|
|
13
12
|
* The `useIsMutating` composable returns a `ref` to the `number` of mutations that your application currently
|
|
14
13
|
* has `pending` (useful for app-wide loading indicators).
|
|
@@ -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,aAAa,KAAK,qCACX,aAAa,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;wBA0Bb,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
|