@tanstack/vue-query 5.104.0 → 5.104.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 +6 -0
- package/build/legacy/devtools/devtools.cjs.map +1 -1
- package/build/legacy/devtools/devtools.d.cts +7 -1
- package/build/legacy/devtools/devtools.d.cts.map +1 -1
- package/build/legacy/devtools/devtools.d.ts +7 -1
- package/build/legacy/devtools/devtools.d.ts.map +1 -1
- package/build/legacy/devtools/devtools.js +6 -0
- package/build/legacy/devtools/devtools.js.map +1 -1
- package/build/legacy/devtools/utils.cjs +21 -0
- package/build/legacy/devtools/utils.cjs.map +1 -1
- package/build/legacy/devtools/utils.d.cts +21 -0
- package/build/legacy/devtools/utils.d.cts.map +1 -1
- package/build/legacy/devtools/utils.d.ts +21 -0
- package/build/legacy/devtools/utils.d.ts.map +1 -1
- package/build/legacy/devtools/utils.js +21 -0
- package/build/legacy/devtools/utils.js.map +1 -1
- package/build/legacy/index.d.cts +6 -6
- package/build/legacy/index.d.ts +6 -6
- package/build/legacy/{infiniteQueryOptions-NucMX_M_.d.ts → infiniteQueryOptions-BaoKhSzb.d.ts} +26 -27
- package/build/legacy/infiniteQueryOptions-BaoKhSzb.d.ts.map +1 -0
- package/build/legacy/{infiniteQueryOptions-CnTRbIP5.d.cts → infiniteQueryOptions-ClNe2-FB.d.cts} +26 -27
- package/build/legacy/infiniteQueryOptions-ClNe2-FB.d.cts.map +1 -0
- package/build/legacy/infiniteQueryOptions.cjs.map +1 -1
- package/build/legacy/infiniteQueryOptions.d.cts +1 -1
- package/build/legacy/infiniteQueryOptions.d.ts +1 -1
- package/build/legacy/infiniteQueryOptions.js.map +1 -1
- package/build/legacy/mutationCache.cjs.map +1 -1
- package/build/legacy/mutationCache.d.cts +1 -1
- package/build/legacy/mutationCache.d.cts.map +1 -1
- package/build/legacy/mutationCache.d.ts +1 -1
- package/build/legacy/mutationCache.d.ts.map +1 -1
- package/build/legacy/mutationCache.js.map +1 -1
- package/build/legacy/mutationOptions.cjs.map +1 -1
- package/build/legacy/mutationOptions.d.cts +5 -13
- package/build/legacy/mutationOptions.d.cts.map +1 -1
- package/build/legacy/mutationOptions.d.ts +5 -13
- package/build/legacy/mutationOptions.d.ts.map +1 -1
- package/build/legacy/mutationOptions.js.map +1 -1
- package/build/legacy/queryCache.cjs.map +1 -1
- package/build/legacy/queryCache.d.cts +1 -1
- package/build/legacy/queryCache.d.cts.map +1 -1
- package/build/legacy/queryCache.d.ts +1 -1
- package/build/legacy/queryCache.d.ts.map +1 -1
- package/build/legacy/queryCache.js.map +1 -1
- package/build/legacy/{queryClient-Bn2Ql_Lu.d.cts → queryClient-BK9W57Qu.d.cts} +3 -3
- package/build/legacy/queryClient-BK9W57Qu.d.cts.map +1 -0
- package/build/legacy/{queryClient-B6mLtXOj.d.ts → queryClient-BoBzDWAZ.d.ts} +3 -3
- package/build/legacy/queryClient-BoBzDWAZ.d.ts.map +1 -0
- package/build/legacy/queryClient.cjs.map +1 -1
- package/build/legacy/queryClient.d.cts +1 -1
- package/build/legacy/queryClient.d.ts +1 -1
- package/build/legacy/queryClient.js.map +1 -1
- package/build/{modern/queryOptions-CwqQgQmQ.d.cts → legacy/queryOptions-BvmZtmiU.d.cts} +14 -19
- package/build/legacy/queryOptions-BvmZtmiU.d.cts.map +1 -0
- package/build/{modern/queryOptions-CsM5TXD2.d.ts → legacy/queryOptions-gpn5D4rf.d.ts} +14 -19
- package/build/legacy/queryOptions-gpn5D4rf.d.ts.map +1 -0
- 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.map +1 -1
- package/build/{modern/types-JpJB72CS.d.cts → legacy/types-sdZdiLgo.d.cts} +48 -3
- package/build/legacy/types-sdZdiLgo.d.cts.map +1 -0
- package/build/legacy/{types-JpJB72CS.d.cts → types-sdZdiLgo.d.ts} +48 -3
- package/build/legacy/types-sdZdiLgo.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 -1
- package/build/legacy/useBaseQuery.cjs.map +1 -1
- package/build/legacy/useBaseQuery.d.cts +1 -1
- package/build/legacy/useBaseQuery.d.ts +1 -1
- package/build/legacy/useBaseQuery.js +1 -1
- package/build/legacy/useBaseQuery.js.map +1 -1
- package/build/legacy/useInfiniteQuery.cjs.map +1 -1
- package/build/legacy/useInfiniteQuery.d.cts +1 -1
- package/build/legacy/useInfiniteQuery.d.ts +1 -1
- package/build/legacy/useInfiniteQuery.js.map +1 -1
- package/build/legacy/useIsFetching.cjs +0 -3
- package/build/legacy/useIsFetching.cjs.map +1 -1
- package/build/legacy/useIsFetching.d.cts +6 -5
- package/build/legacy/useIsFetching.d.cts.map +1 -1
- package/build/legacy/useIsFetching.d.ts +6 -5
- package/build/legacy/useIsFetching.d.ts.map +1 -1
- package/build/legacy/useIsFetching.js +0 -3
- package/build/legacy/useIsFetching.js.map +1 -1
- package/build/legacy/useMutation.cjs +2 -8
- package/build/legacy/useMutation.cjs.map +1 -1
- package/build/legacy/useMutation.d.cts +17 -11
- package/build/legacy/useMutation.d.cts.map +1 -1
- package/build/legacy/useMutation.d.ts +17 -11
- package/build/legacy/useMutation.d.ts.map +1 -1
- package/build/legacy/useMutation.js +2 -8
- package/build/legacy/useMutation.js.map +1 -1
- package/build/legacy/useMutationState.cjs +7 -6
- package/build/legacy/useMutationState.cjs.map +1 -1
- package/build/legacy/useMutationState.d.cts +16 -8
- package/build/legacy/useMutationState.d.cts.map +1 -1
- package/build/legacy/useMutationState.d.ts +16 -8
- package/build/legacy/useMutationState.d.ts.map +1 -1
- package/build/legacy/useMutationState.js +7 -6
- package/build/legacy/useMutationState.js.map +1 -1
- package/build/legacy/usePrefetchInfiniteQuery.cjs +5 -3
- package/build/legacy/usePrefetchInfiniteQuery.cjs.map +1 -1
- package/build/legacy/usePrefetchInfiniteQuery.d.cts +6 -5
- package/build/legacy/usePrefetchInfiniteQuery.d.cts.map +1 -1
- package/build/legacy/usePrefetchInfiniteQuery.d.ts +6 -5
- package/build/legacy/usePrefetchInfiniteQuery.d.ts.map +1 -1
- package/build/legacy/usePrefetchInfiniteQuery.js +5 -3
- package/build/legacy/usePrefetchInfiniteQuery.js.map +1 -1
- package/build/legacy/usePrefetchQuery.cjs +5 -3
- package/build/legacy/usePrefetchQuery.cjs.map +1 -1
- package/build/legacy/usePrefetchQuery.d.cts +6 -5
- package/build/legacy/usePrefetchQuery.d.cts.map +1 -1
- package/build/legacy/usePrefetchQuery.d.ts +6 -5
- package/build/legacy/usePrefetchQuery.d.ts.map +1 -1
- package/build/legacy/usePrefetchQuery.js +5 -3
- package/build/legacy/usePrefetchQuery.js.map +1 -1
- package/build/legacy/useQueries.cjs +1 -4
- package/build/legacy/useQueries.cjs.map +1 -1
- package/build/legacy/useQueries.d.cts +4 -7
- package/build/legacy/useQueries.d.cts.map +1 -1
- package/build/legacy/useQueries.d.ts +4 -7
- package/build/legacy/useQueries.d.ts.map +1 -1
- package/build/legacy/useQueries.js +1 -4
- package/build/legacy/useQueries.js.map +1 -1
- package/build/legacy/useQuery.cjs.map +1 -1
- package/build/legacy/useQuery.d.cts +12 -15
- package/build/legacy/useQuery.d.cts.map +1 -1
- package/build/legacy/useQuery.d.ts +12 -15
- package/build/legacy/useQuery.d.ts.map +1 -1
- package/build/legacy/useQuery.js.map +1 -1
- package/build/legacy/useQueryClient.cjs +3 -3
- package/build/legacy/useQueryClient.cjs.map +1 -1
- package/build/legacy/useQueryClient.d.cts +4 -4
- package/build/legacy/useQueryClient.d.ts +4 -4
- package/build/legacy/useQueryClient.js +3 -3
- package/build/legacy/useQueryClient.js.map +1 -1
- package/build/legacy/utils.cjs +54 -6
- package/build/legacy/utils.cjs.map +1 -1
- package/build/legacy/utils.d.cts +34 -7
- package/build/legacy/utils.d.cts.map +1 -1
- package/build/legacy/utils.d.ts +34 -7
- package/build/legacy/utils.d.ts.map +1 -1
- package/build/legacy/utils.js +54 -6
- package/build/legacy/utils.js.map +1 -1
- package/build/legacy/vueQueryPlugin.cjs +0 -3
- package/build/legacy/vueQueryPlugin.cjs.map +1 -1
- package/build/legacy/vueQueryPlugin.d.cts +6 -5
- package/build/legacy/vueQueryPlugin.d.cts.map +1 -1
- package/build/legacy/vueQueryPlugin.d.ts +6 -5
- package/build/legacy/vueQueryPlugin.d.ts.map +1 -1
- package/build/legacy/vueQueryPlugin.js +0 -3
- package/build/legacy/vueQueryPlugin.js.map +1 -1
- package/build/modern/devtools/devtools.cjs +6 -0
- package/build/modern/devtools/devtools.cjs.map +1 -1
- package/build/modern/devtools/devtools.d.cts +7 -1
- package/build/modern/devtools/devtools.d.cts.map +1 -1
- package/build/modern/devtools/devtools.d.ts +7 -1
- package/build/modern/devtools/devtools.d.ts.map +1 -1
- package/build/modern/devtools/devtools.js +6 -0
- package/build/modern/devtools/devtools.js.map +1 -1
- package/build/modern/devtools/utils.cjs +21 -0
- package/build/modern/devtools/utils.cjs.map +1 -1
- package/build/modern/devtools/utils.d.cts +21 -0
- package/build/modern/devtools/utils.d.cts.map +1 -1
- package/build/modern/devtools/utils.d.ts +21 -0
- package/build/modern/devtools/utils.d.ts.map +1 -1
- package/build/modern/devtools/utils.js +21 -0
- package/build/modern/devtools/utils.js.map +1 -1
- package/build/modern/index.d.cts +6 -6
- package/build/modern/index.d.ts +6 -6
- package/build/modern/{infiniteQueryOptions-NucMX_M_.d.ts → infiniteQueryOptions-BaoKhSzb.d.ts} +26 -27
- package/build/modern/infiniteQueryOptions-BaoKhSzb.d.ts.map +1 -0
- package/build/modern/{infiniteQueryOptions-CnTRbIP5.d.cts → infiniteQueryOptions-ClNe2-FB.d.cts} +26 -27
- package/build/modern/infiniteQueryOptions-ClNe2-FB.d.cts.map +1 -0
- package/build/modern/infiniteQueryOptions.cjs.map +1 -1
- package/build/modern/infiniteQueryOptions.d.cts +1 -1
- package/build/modern/infiniteQueryOptions.d.ts +1 -1
- package/build/modern/infiniteQueryOptions.js.map +1 -1
- package/build/modern/mutationCache.cjs.map +1 -1
- package/build/modern/mutationCache.d.cts +1 -1
- package/build/modern/mutationCache.d.cts.map +1 -1
- package/build/modern/mutationCache.d.ts +1 -1
- package/build/modern/mutationCache.d.ts.map +1 -1
- package/build/modern/mutationCache.js.map +1 -1
- package/build/modern/mutationOptions.cjs.map +1 -1
- package/build/modern/mutationOptions.d.cts +5 -13
- package/build/modern/mutationOptions.d.cts.map +1 -1
- package/build/modern/mutationOptions.d.ts +5 -13
- package/build/modern/mutationOptions.d.ts.map +1 -1
- package/build/modern/mutationOptions.js.map +1 -1
- package/build/modern/queryCache.cjs.map +1 -1
- package/build/modern/queryCache.d.cts +1 -1
- package/build/modern/queryCache.d.cts.map +1 -1
- package/build/modern/queryCache.d.ts +1 -1
- package/build/modern/queryCache.d.ts.map +1 -1
- package/build/modern/queryCache.js.map +1 -1
- package/build/modern/{queryClient-Bn2Ql_Lu.d.cts → queryClient-BK9W57Qu.d.cts} +3 -3
- package/build/modern/queryClient-BK9W57Qu.d.cts.map +1 -0
- package/build/modern/{queryClient-B6mLtXOj.d.ts → queryClient-BoBzDWAZ.d.ts} +3 -3
- package/build/modern/queryClient-BoBzDWAZ.d.ts.map +1 -0
- package/build/modern/queryClient.cjs.map +1 -1
- package/build/modern/queryClient.d.cts +1 -1
- package/build/modern/queryClient.d.ts +1 -1
- package/build/modern/queryClient.js.map +1 -1
- package/build/{legacy/queryOptions-CwqQgQmQ.d.cts → modern/queryOptions-BvmZtmiU.d.cts} +14 -19
- package/build/modern/queryOptions-BvmZtmiU.d.cts.map +1 -0
- package/build/{legacy/queryOptions-CsM5TXD2.d.ts → modern/queryOptions-gpn5D4rf.d.ts} +14 -19
- package/build/modern/queryOptions-gpn5D4rf.d.ts.map +1 -0
- 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.map +1 -1
- package/build/modern/{types-JpJB72CS.d.ts → types-sdZdiLgo.d.cts} +48 -3
- package/build/modern/types-sdZdiLgo.d.cts.map +1 -0
- package/build/{legacy/types-JpJB72CS.d.ts → modern/types-sdZdiLgo.d.ts} +48 -3
- package/build/modern/types-sdZdiLgo.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 -1
- package/build/modern/useBaseQuery.cjs.map +1 -1
- package/build/modern/useBaseQuery.d.cts +1 -1
- package/build/modern/useBaseQuery.d.ts +1 -1
- package/build/modern/useBaseQuery.js +1 -1
- package/build/modern/useBaseQuery.js.map +1 -1
- package/build/modern/useInfiniteQuery.cjs.map +1 -1
- package/build/modern/useInfiniteQuery.d.cts +1 -1
- package/build/modern/useInfiniteQuery.d.ts +1 -1
- package/build/modern/useInfiniteQuery.js.map +1 -1
- package/build/modern/useIsFetching.cjs +0 -3
- package/build/modern/useIsFetching.cjs.map +1 -1
- package/build/modern/useIsFetching.d.cts +6 -5
- package/build/modern/useIsFetching.d.cts.map +1 -1
- package/build/modern/useIsFetching.d.ts +6 -5
- package/build/modern/useIsFetching.d.ts.map +1 -1
- package/build/modern/useIsFetching.js +0 -3
- package/build/modern/useIsFetching.js.map +1 -1
- package/build/modern/useMutation.cjs +2 -8
- package/build/modern/useMutation.cjs.map +1 -1
- package/build/modern/useMutation.d.cts +17 -11
- package/build/modern/useMutation.d.cts.map +1 -1
- package/build/modern/useMutation.d.ts +17 -11
- package/build/modern/useMutation.d.ts.map +1 -1
- package/build/modern/useMutation.js +2 -8
- package/build/modern/useMutation.js.map +1 -1
- package/build/modern/useMutationState.cjs +7 -6
- package/build/modern/useMutationState.cjs.map +1 -1
- package/build/modern/useMutationState.d.cts +16 -8
- package/build/modern/useMutationState.d.cts.map +1 -1
- package/build/modern/useMutationState.d.ts +16 -8
- package/build/modern/useMutationState.d.ts.map +1 -1
- package/build/modern/useMutationState.js +7 -6
- package/build/modern/useMutationState.js.map +1 -1
- package/build/modern/usePrefetchInfiniteQuery.cjs +5 -3
- package/build/modern/usePrefetchInfiniteQuery.cjs.map +1 -1
- package/build/modern/usePrefetchInfiniteQuery.d.cts +6 -5
- package/build/modern/usePrefetchInfiniteQuery.d.cts.map +1 -1
- package/build/modern/usePrefetchInfiniteQuery.d.ts +6 -5
- package/build/modern/usePrefetchInfiniteQuery.d.ts.map +1 -1
- package/build/modern/usePrefetchInfiniteQuery.js +5 -3
- package/build/modern/usePrefetchInfiniteQuery.js.map +1 -1
- package/build/modern/usePrefetchQuery.cjs +5 -3
- package/build/modern/usePrefetchQuery.cjs.map +1 -1
- package/build/modern/usePrefetchQuery.d.cts +6 -5
- package/build/modern/usePrefetchQuery.d.cts.map +1 -1
- package/build/modern/usePrefetchQuery.d.ts +6 -5
- package/build/modern/usePrefetchQuery.d.ts.map +1 -1
- package/build/modern/usePrefetchQuery.js +5 -3
- package/build/modern/usePrefetchQuery.js.map +1 -1
- package/build/modern/useQueries.cjs +1 -4
- package/build/modern/useQueries.cjs.map +1 -1
- package/build/modern/useQueries.d.cts +4 -7
- package/build/modern/useQueries.d.cts.map +1 -1
- package/build/modern/useQueries.d.ts +4 -7
- package/build/modern/useQueries.d.ts.map +1 -1
- package/build/modern/useQueries.js +1 -4
- package/build/modern/useQueries.js.map +1 -1
- package/build/modern/useQuery.cjs.map +1 -1
- package/build/modern/useQuery.d.cts +12 -15
- package/build/modern/useQuery.d.cts.map +1 -1
- package/build/modern/useQuery.d.ts +12 -15
- package/build/modern/useQuery.d.ts.map +1 -1
- package/build/modern/useQuery.js.map +1 -1
- package/build/modern/useQueryClient.cjs +3 -3
- package/build/modern/useQueryClient.cjs.map +1 -1
- package/build/modern/useQueryClient.d.cts +4 -4
- package/build/modern/useQueryClient.d.ts +4 -4
- package/build/modern/useQueryClient.js +3 -3
- package/build/modern/useQueryClient.js.map +1 -1
- package/build/modern/utils.cjs +54 -6
- package/build/modern/utils.cjs.map +1 -1
- package/build/modern/utils.d.cts +34 -7
- package/build/modern/utils.d.cts.map +1 -1
- package/build/modern/utils.d.ts +34 -7
- package/build/modern/utils.d.ts.map +1 -1
- package/build/modern/utils.js +54 -6
- package/build/modern/utils.js.map +1 -1
- package/build/modern/vueQueryPlugin.cjs +0 -3
- package/build/modern/vueQueryPlugin.cjs.map +1 -1
- package/build/modern/vueQueryPlugin.d.cts +6 -5
- package/build/modern/vueQueryPlugin.d.cts.map +1 -1
- package/build/modern/vueQueryPlugin.d.ts +6 -5
- package/build/modern/vueQueryPlugin.d.ts.map +1 -1
- package/build/modern/vueQueryPlugin.js +0 -3
- package/build/modern/vueQueryPlugin.js.map +1 -1
- package/package.json +6 -6
- package/src/devtools/devtools.ts +6 -0
- package/src/devtools/utils.ts +21 -0
- package/src/index.ts +5 -1
- package/src/infiniteQueryOptions.ts +2 -8
- package/src/mutationCache.ts +4 -2
- package/src/mutationOptions.ts +4 -12
- package/src/queryCache.ts +6 -2
- package/src/queryClient.ts +55 -52
- package/src/queryOptions.ts +22 -25
- package/src/types.ts +47 -2
- package/src/useBaseQuery.ts +8 -2
- package/src/useInfiniteQuery.ts +15 -14
- package/src/useIsFetching.ts +6 -4
- package/src/useMutation.ts +15 -9
- package/src/useMutationState.ts +23 -7
- package/src/usePrefetchInfiniteQuery.ts +9 -3
- package/src/usePrefetchQuery.ts +9 -3
- package/src/useQueries.ts +1 -4
- package/src/useQuery.ts +10 -12
- package/src/useQueryClient.ts +3 -3
- package/src/utils.ts +55 -9
- package/src/vueQueryPlugin.ts +4 -3
- package/build/legacy/infiniteQueryOptions-CnTRbIP5.d.cts.map +0 -1
- package/build/legacy/infiniteQueryOptions-NucMX_M_.d.ts.map +0 -1
- package/build/legacy/queryClient-B6mLtXOj.d.ts.map +0 -1
- package/build/legacy/queryClient-Bn2Ql_Lu.d.cts.map +0 -1
- package/build/legacy/queryOptions-CsM5TXD2.d.ts.map +0 -1
- package/build/legacy/queryOptions-CwqQgQmQ.d.cts.map +0 -1
- package/build/legacy/types-JpJB72CS.d.cts.map +0 -1
- package/build/legacy/types-JpJB72CS.d.ts.map +0 -1
- package/build/modern/infiniteQueryOptions-CnTRbIP5.d.cts.map +0 -1
- package/build/modern/infiniteQueryOptions-NucMX_M_.d.ts.map +0 -1
- package/build/modern/queryClient-B6mLtXOj.d.ts.map +0 -1
- package/build/modern/queryClient-Bn2Ql_Lu.d.cts.map +0 -1
- package/build/modern/queryOptions-CsM5TXD2.d.ts.map +0 -1
- package/build/modern/queryOptions-CwqQgQmQ.d.cts.map +0 -1
- package/build/modern/types-JpJB72CS.d.cts.map +0 -1
- package/build/modern/types-JpJB72CS.d.ts.map +0 -1
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { o as MaybeRefDeep } from "./types-
|
|
2
|
-
import { t as QueryClient$1 } from "./queryClient-
|
|
1
|
+
import { o as MaybeRefDeep } from "./types-sdZdiLgo.js";
|
|
2
|
+
import { t as QueryClient$1 } from "./queryClient-BoBzDWAZ.js";
|
|
3
3
|
import { Mutation, MutationFilters, MutationState } from "@tanstack/query-core";
|
|
4
4
|
import { Ref } from "vue-demi";
|
|
5
5
|
//#region src/useMutationState.d.ts
|
|
6
6
|
type VueMutationFilters = MaybeRefDeep<MutationFilters>;
|
|
7
|
+
/**
|
|
8
|
+
* The filters accepted by `useIsMutating`: {@link MutationFilters} as a plain object, a `ref`, or a reactive
|
|
9
|
+
* getter.
|
|
10
|
+
*/
|
|
7
11
|
export type UseIsMutatingFilters = VueMutationFilters | (() => VueMutationFilters);
|
|
8
12
|
/**
|
|
9
13
|
* The `useIsMutating` composable returns a `ref` to the `number` of mutations that your application currently
|
|
@@ -11,12 +15,10 @@ export type UseIsMutatingFilters = VueMutationFilters | (() => VueMutationFilter
|
|
|
11
15
|
*
|
|
12
16
|
* `filters` may be a plain object, `MaybeRefDeep`, or a reactive getter (`() => ({ ... })`) — pass a getter if
|
|
13
17
|
* the filters themselves depend on other reactive state.
|
|
14
|
-
*
|
|
15
18
|
* @param filters - The {@link MutationFilters} to narrow down the matched mutations.
|
|
16
19
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`
|
|
17
20
|
* will be used.
|
|
18
21
|
* @returns A `ref` to the `number` of the mutations that your application currently has `pending`.
|
|
19
|
-
*
|
|
20
22
|
* @example
|
|
21
23
|
* ```vue
|
|
22
24
|
* <script setup lang="ts">
|
|
@@ -33,8 +35,18 @@ export type UseIsMutatingFilters = VueMutationFilters | (() => VueMutationFilter
|
|
|
33
35
|
*/
|
|
34
36
|
export declare function useIsMutating(filters?: UseIsMutatingFilters, queryClient?: QueryClient$1): Ref<number>;
|
|
35
37
|
type MutationTypeFromResult<TResult> = [TResult] extends [MutationState<infer TData, infer TError, infer TVariables, infer TOnMutateResult>] ? Mutation<TData, TError, TVariables, TOnMutateResult> : Mutation;
|
|
38
|
+
/**
|
|
39
|
+
* The options accepted by `useMutationState`: the `filters` matching the mutations, and `select` to map each
|
|
40
|
+
* one (to its state, by default).
|
|
41
|
+
*/
|
|
36
42
|
export type MutationStateOptions<TResult = MutationState, TMutation extends Mutation<any, any, any, any> = MutationTypeFromResult<TResult>> = {
|
|
43
|
+
/**
|
|
44
|
+
* The filters that select the mutations to return the state of.
|
|
45
|
+
*/
|
|
37
46
|
filters?: VueMutationFilters;
|
|
47
|
+
/**
|
|
48
|
+
* Maps each matching mutation to the value returned for it. Defaults to the mutation's `state`.
|
|
49
|
+
*/
|
|
38
50
|
select?: (mutation: TMutation) => TResult;
|
|
39
51
|
};
|
|
40
52
|
/**
|
|
@@ -44,13 +56,11 @@ export type MutationStateOptions<TResult = MutationState, TMutation extends Muta
|
|
|
44
56
|
*
|
|
45
57
|
* `options` may be a plain object or a reactive getter (`() => ({ ... })`) — pass a getter if the filters
|
|
46
58
|
* themselves depend on other reactive state.
|
|
47
|
-
*
|
|
48
59
|
* @param options - The `filters` to narrow down matched mutations, and an optional `select` to transform the
|
|
49
60
|
* mutation state.
|
|
50
61
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`
|
|
51
62
|
* will be used.
|
|
52
63
|
* @returns A `ref` to an Array of whatever `select` returns for each matching mutation.
|
|
53
|
-
*
|
|
54
64
|
* @example
|
|
55
65
|
* Get all variables of all running mutations:
|
|
56
66
|
* ```vue
|
|
@@ -65,7 +75,6 @@ export type MutationStateOptions<TResult = MutationState, TMutation extends Muta
|
|
|
65
75
|
*
|
|
66
76
|
* <template>{{ pendingVariables.length }} posts saving...</template>
|
|
67
77
|
* ```
|
|
68
|
-
*
|
|
69
78
|
* @example
|
|
70
79
|
* Get all data for specific mutations via the `mutationKey`:
|
|
71
80
|
* ```vue
|
|
@@ -93,7 +102,6 @@ export type MutationStateOptions<TResult = MutationState, TMutation extends Muta
|
|
|
93
102
|
* </button>
|
|
94
103
|
* </template>
|
|
95
104
|
* ```
|
|
96
|
-
*
|
|
97
105
|
* @example
|
|
98
106
|
* Access the latest successful mutation data via the `mutationKey`. Each invocation of `mutate` adds a new
|
|
99
107
|
* entry to the mutation cache for `gcTime` milliseconds — with the `status: 'success'` filter below, check the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMutationState.d.ts","names":["QueryClient"],"sources":["../../src/useMutationState.ts"],"mappings":";;;;;KAoBK,qBAAqB,aAAa
|
|
1
|
+
{"version":3,"file":"useMutationState.d.ts","names":["QueryClient"],"sources":["../../src/useMutationState.ts"],"mappings":";;;;;KAoBK,qBAAqB,aAAa;;;;;YAM3B,uBACR,4BACO;;;;;;;;;;;;;;;;;;;;;;;;;wBA0BK,cACd,UAAS,sBACT,cAAcA,gBACb;KAyBE,uBAAuB,YAAY,kBACtC,oBACQ,aACA,cACA,kBACA,oBAGN,SAAS,OAAO,QAAQ,YAAY,mBACpC;;;;;YAMQ,qBACV,UAAU,eACV,kBAAkB,+BAChB,uBAAuB;;;;EAKzB,UAAU;;;;EAIV,UAAU,UAAU,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAqGpB,iBACd,UAAU,eACV,kBAAkB,+BAChB,uBAAuB,UAEzB,UACI,qBAAqB,SAAS,oBACvB,qBAAqB,SAAS,aACzC,cAAcA,gBACb,SAAS,IAAI,MAAM"}
|
|
@@ -8,12 +8,10 @@ import { computed, getCurrentScope, onScopeDispose, shallowReadonly, shallowRef,
|
|
|
8
8
|
*
|
|
9
9
|
* `filters` may be a plain object, `MaybeRefDeep`, or a reactive getter (`() => ({ ... })`) — pass a getter if
|
|
10
10
|
* the filters themselves depend on other reactive state.
|
|
11
|
-
*
|
|
12
11
|
* @param filters - The {@link MutationFilters} to narrow down the matched mutations.
|
|
13
12
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`
|
|
14
13
|
* will be used.
|
|
15
14
|
* @returns A `ref` to the `number` of the mutations that your application currently has `pending`.
|
|
16
|
-
*
|
|
17
15
|
* @example
|
|
18
16
|
* ```vue
|
|
19
17
|
* <script setup lang="ts">
|
|
@@ -39,6 +37,13 @@ function useIsMutating(filters = {}, queryClient) {
|
|
|
39
37
|
})) }, client);
|
|
40
38
|
return computed(() => mutationState.value.length);
|
|
41
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Collects the mutations in the cache that match `options.filters`, mapped with `options.select`
|
|
42
|
+
* (or to their state, by default).
|
|
43
|
+
* @param mutationCache - The mutation cache to read.
|
|
44
|
+
* @param options - The `filters` to match and the `select` function to map each mutation with.
|
|
45
|
+
* @returns The selected value of every matching mutation.
|
|
46
|
+
*/
|
|
42
47
|
function getResult(mutationCache, options) {
|
|
43
48
|
return mutationCache.findAll(options.filters).map((mutation) => options.select ? options.select(mutation) : mutation.state);
|
|
44
49
|
}
|
|
@@ -49,13 +54,11 @@ function getResult(mutationCache, options) {
|
|
|
49
54
|
*
|
|
50
55
|
* `options` may be a plain object or a reactive getter (`() => ({ ... })`) — pass a getter if the filters
|
|
51
56
|
* themselves depend on other reactive state.
|
|
52
|
-
*
|
|
53
57
|
* @param options - The `filters` to narrow down matched mutations, and an optional `select` to transform the
|
|
54
58
|
* mutation state.
|
|
55
59
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`
|
|
56
60
|
* will be used.
|
|
57
61
|
* @returns A `ref` to an Array of whatever `select` returns for each matching mutation.
|
|
58
|
-
*
|
|
59
62
|
* @example
|
|
60
63
|
* Get all variables of all running mutations:
|
|
61
64
|
* ```vue
|
|
@@ -70,7 +73,6 @@ function getResult(mutationCache, options) {
|
|
|
70
73
|
*
|
|
71
74
|
* <template>{{ pendingVariables.length }} posts saving...</template>
|
|
72
75
|
* ```
|
|
73
|
-
*
|
|
74
76
|
* @example
|
|
75
77
|
* Get all data for specific mutations via the `mutationKey`:
|
|
76
78
|
* ```vue
|
|
@@ -98,7 +100,6 @@ function getResult(mutationCache, options) {
|
|
|
98
100
|
* </button>
|
|
99
101
|
* </template>
|
|
100
102
|
* ```
|
|
101
|
-
*
|
|
102
103
|
* @example
|
|
103
104
|
* Access the latest successful mutation data via the `mutationKey`. Each invocation of `mutate` adds a new
|
|
104
105
|
* entry to the mutation cache for `gcTime` milliseconds — with the `status: 'success'` filter below, check the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMutationState.js","names":[],"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\nexport type UseIsMutatingFilters =\n VueMutationFilters
|
|
1
|
+
{"version":3,"file":"useMutationState.js","names":[],"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 | VueMutationFilters\n | (() => VueMutationFilters)\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,CAAC,gBAAgB,GACnB,QAAQ,KACN,kKACF;CAAA;CAIJ,MAAM,SAAS,eAAe,eAAe;CAE7C,MAAM,gBAAgB,iBACpB,EACE,SAAS,gBAAgB;EACvB,GAAG,eAAe,OAAO,YAAY,aAAa,QAAQ,IAAI,OAAO;EACrE,QAAQ;CACV,EAAE,EACJ,GACA,MACF;CAGA,OAFe,eAAe,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,kBAAkB,eAAe;EACrC,MAAM,aAAa,OAAO,YAAY,aAAa,QAAQ,IAAI;EAC/D,OAAO;GACL,SAAS,eAAe,WAAW,OAAO;GAC1C,QAAQ,WAAW;EACrB;CACF,CAAC;CACD,MAAM,iBAAiB,eAAe,eAAe,EAAA,CAAG,iBAAiB;CACzE,MAAM,QAAQ,WAAW,UAAU,eAAe,gBAAgB,KAAK,CAAC;CACxE,MAAM,cAAc,cAAc,gBAAgB;EAChD,MAAM,QAAQ,UAAU,eAAe,gBAAgB,KAAK;CAC9D,CAAC;CAED,MAAM,uBAAuB;EAC3B,MAAM,QAAQ,UAAU,eAAe,gBAAgB,KAAK;CAC9D,CAAC;CAED,qBAAqB;EACnB,YAAY;CACd,CAAC;CAED,OAAO,gBAAgB,KAAK;AAC9B"}
|
|
@@ -4,6 +4,11 @@ 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
|
//#region src/usePrefetchInfiniteQuery.ts
|
|
7
|
+
/**
|
|
8
|
+
* Checks whether an option was passed as a getter function.
|
|
9
|
+
* @param value - The option value.
|
|
10
|
+
* @returns `true` if `value` is a function.
|
|
11
|
+
*/
|
|
7
12
|
function isGetter(value) {
|
|
8
13
|
return typeof value === "function";
|
|
9
14
|
}
|
|
@@ -24,13 +29,10 @@ function isGetter(value) {
|
|
|
24
29
|
*
|
|
25
30
|
* Fire this during render, before a suspense boundary that wraps a component using `useInfiniteQuery`'s
|
|
26
31
|
* `suspense()` — see the {@link https://tanstack.com/query/latest/docs/framework/vue/guides/suspense | Suspense guide}.
|
|
27
|
-
*
|
|
28
32
|
* @param options - A `ref`, plain value, or reactive getter resolving to the
|
|
29
33
|
* {@link UsePrefetchInfiniteQueryOptions} to use — everything you can pass to `queryClient.infiniteQuery`.
|
|
30
34
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`
|
|
31
35
|
* will be used.
|
|
32
|
-
* @returns `void` — nothing is returned.
|
|
33
|
-
*
|
|
34
36
|
* @example
|
|
35
37
|
* ```vue
|
|
36
38
|
* <script setup lang="ts">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePrefetchInfiniteQuery.cjs","names":["getCurrentScope","useQueryClient","unref","cloneDeepUnref","noop"],"sources":["../../src/usePrefetchInfiniteQuery.ts"],"sourcesContent":["import { getCurrentScope, unref, watchEffect } from 'vue-demi'\nimport { noop } from '@tanstack/query-core'\nimport { useQueryClient } from './useQueryClient'\nimport { cloneDeepUnref } from './utils'\nimport type {\n DefaultError,\n DistributiveOmit,\n InfiniteData,\n InfiniteQueryExecuteOptions,\n QueryKey,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { QueryClient } from './queryClient'\nimport type { MaybeRefDeep, MaybeRefOrGetter } from './types'\n\nexport type UsePrefetchInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey extends QueryKey,\n TPageParam,\n> = DistributiveOmit<\n InfiniteQueryExecuteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n 'queryFn'\n> & {\n queryFn?: Exclude<\n InfiniteQueryExecuteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >['queryFn'],\n SkipToken\n >\n}\n\nfunction isGetter<T>(value: MaybeRefOrGetter<T>): value is () => T {\n return typeof value === 'function'\n}\n\n/**\n * `usePrefetchInfiniteQuery` does not return anything — it fires a prefetch as a reactive side effect, useful\n * for kicking off a fetch ahead of the component that will actually render the data with `useInfiniteQuery`.\n * You can pass everything to `usePrefetchInfiniteQuery` that you can pass to `queryClient.infiniteQuery`,\n * though `queryKey`, `initialPageParam`, and `getNextPageParam` are always required, and `queryFn` is required\n * unless a default query function has been defined.\n *\n * `getNextPageParam` receives both the last page of the infinite list of data and the full array of all pages,\n * as well as pageParam information, and should return a single variable that will be passed to your query\n * function as `context.pageParam`. Return `undefined` or `null` to indicate there is no next page available.\n *\n * The prefetch is skipped if the query already has any cached state — including a `pending`/`error` state left\n * over from a previous attempt — so it won't refetch data that's already there or already in flight. It\n * re-runs whenever a reactive dependency in `options` (built with `infiniteQueryOptions`, for example) changes.\n *\n * Fire this during render, before a suspense boundary that wraps a component using `useInfiniteQuery`'s\n * `suspense()` — see the {@link https://tanstack.com/query/latest/docs/framework/vue/guides/suspense | Suspense guide}.\n
|
|
1
|
+
{"version":3,"file":"usePrefetchInfiniteQuery.cjs","names":["getCurrentScope","useQueryClient","unref","cloneDeepUnref","noop"],"sources":["../../src/usePrefetchInfiniteQuery.ts"],"sourcesContent":["import { getCurrentScope, unref, watchEffect } from 'vue-demi'\nimport { noop } from '@tanstack/query-core'\nimport { useQueryClient } from './useQueryClient'\nimport { cloneDeepUnref } from './utils'\nimport type {\n DefaultError,\n DistributiveOmit,\n InfiniteData,\n InfiniteQueryExecuteOptions,\n QueryKey,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { QueryClient } from './queryClient'\nimport type { MaybeRefDeep, MaybeRefOrGetter } from './types'\n\n/**\n * The options accepted by `usePrefetchInfiniteQuery` — everything you can pass to `queryClient.infiniteQuery`,\n * except that `queryFn` can't be `skipToken`.\n */\nexport type UsePrefetchInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey extends QueryKey,\n TPageParam,\n> = DistributiveOmit<\n InfiniteQueryExecuteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n 'queryFn'\n> & {\n queryFn?: Exclude<\n InfiniteQueryExecuteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >['queryFn'],\n SkipToken\n >\n}\n\n/**\n * Checks whether an option was passed as a getter function.\n * @param value - The option value.\n * @returns `true` if `value` is a function.\n */\nfunction isGetter<T>(value: MaybeRefOrGetter<T>): value is () => T {\n return typeof value === 'function'\n}\n\n/**\n * `usePrefetchInfiniteQuery` does not return anything — it fires a prefetch as a reactive side effect, useful\n * for kicking off a fetch ahead of the component that will actually render the data with `useInfiniteQuery`.\n * You can pass everything to `usePrefetchInfiniteQuery` that you can pass to `queryClient.infiniteQuery`,\n * though `queryKey`, `initialPageParam`, and `getNextPageParam` are always required, and `queryFn` is required\n * unless a default query function has been defined.\n *\n * `getNextPageParam` receives both the last page of the infinite list of data and the full array of all pages,\n * as well as pageParam information, and should return a single variable that will be passed to your query\n * function as `context.pageParam`. Return `undefined` or `null` to indicate there is no next page available.\n *\n * The prefetch is skipped if the query already has any cached state — including a `pending`/`error` state left\n * over from a previous attempt — so it won't refetch data that's already there or already in flight. It\n * re-runs whenever a reactive dependency in `options` (built with `infiniteQueryOptions`, for example) changes.\n *\n * Fire this during render, before a suspense boundary that wraps a component using `useInfiniteQuery`'s\n * `suspense()` — see the {@link https://tanstack.com/query/latest/docs/framework/vue/guides/suspense | Suspense guide}.\n * @param options - A `ref`, plain value, or reactive getter resolving to the\n * {@link UsePrefetchInfiniteQueryOptions} to use — everything you can pass to `queryClient.infiniteQuery`.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`\n * will be used.\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { infiniteQueryOptions, usePrefetchInfiniteQuery } from '@tanstack/vue-query'\n * import Projects from './Projects.vue'\n *\n * const projectsOptions = infiniteQueryOptions({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n *\n * // Fire the prefetch as soon as this component runs, before `Projects` mounts and calls `useInfiniteQuery`.\n * usePrefetchInfiniteQuery(projectsOptions)\n * </script>\n *\n * <template>\n * <Projects />\n * </template>\n * ```\n */\nexport function usePrefetchInfiniteQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: MaybeRefOrGetter<\n MaybeRefDeep<\n UsePrefetchInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >\n >\n >,\n queryClient?: QueryClient,\n): void {\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 watchEffect(() => {\n const resolvedOptions = isGetter(options) ? options() : unref(options)\n\n const clonedOptions: UsePrefetchInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n > = cloneDeepUnref(resolvedOptions)\n\n if (!client.getQueryState(clonedOptions.queryKey)) {\n void client.infiniteQuery(clonedOptions).then(noop).catch(noop)\n }\n })\n}\n"],"mappings":";;;;;;;;;;;AAoDA,SAAS,SAAY,OAA8C;CACjE,OAAO,OAAO,UAAU;AAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,SAAgB,yBAOd,SAWA,aACM;CACN,IAAI,QAAQ,IAAI,aAAa,eACvB;MAAA,EAAA,GAACA,SAAAA,gBAAAA,CAAgB,GACnB,QAAQ,KACN,kKACF;CAAA;CAIJ,MAAM,SAAS,eAAeC,uBAAAA,eAAe;CAE7C,CAAA,GAAA,SAAA,YAAA,OAAkB;EAChB,MAAM,kBAAkB,SAAS,OAAO,IAAI,QAAQ,KAAA,GAAIC,SAAAA,MAAAA,CAAM,OAAO;EAErE,MAAM,gBAMFC,cAAAA,eAAe,eAAe;EAElC,IAAI,CAAC,OAAO,cAAc,cAAc,QAAQ,GAC9C,OAAY,cAAc,aAAa,CAAC,CAAC,KAAKC,qBAAAA,IAAI,CAAC,CAAC,MAAMA,qBAAAA,IAAI;CAElE,CAAC;AACH"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { o as MaybeRefDeep, s as MaybeRefOrGetter } from "./types-
|
|
2
|
-
import { t as QueryClient$1 } from "./queryClient-
|
|
1
|
+
import { o as MaybeRefDeep, s as MaybeRefOrGetter } from "./types-sdZdiLgo.cjs";
|
|
2
|
+
import { t as QueryClient$1 } from "./queryClient-BK9W57Qu.cjs";
|
|
3
3
|
import { DefaultError, DistributiveOmit, InfiniteData, InfiniteQueryExecuteOptions, QueryKey, SkipToken } from "@tanstack/query-core";
|
|
4
4
|
//#region src/usePrefetchInfiniteQuery.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* The options accepted by `usePrefetchInfiniteQuery` — everything you can pass to `queryClient.infiniteQuery`,
|
|
7
|
+
* except that `queryFn` can't be `skipToken`.
|
|
8
|
+
*/
|
|
5
9
|
export type UsePrefetchInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey extends QueryKey, TPageParam> = DistributiveOmit<InfiniteQueryExecuteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'queryFn'> & {
|
|
6
10
|
queryFn?: Exclude<InfiniteQueryExecuteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>['queryFn'], SkipToken>;
|
|
7
11
|
};
|
|
@@ -22,13 +26,10 @@ export type UsePrefetchInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryK
|
|
|
22
26
|
*
|
|
23
27
|
* Fire this during render, before a suspense boundary that wraps a component using `useInfiniteQuery`'s
|
|
24
28
|
* `suspense()` — see the {@link https://tanstack.com/query/latest/docs/framework/vue/guides/suspense | Suspense guide}.
|
|
25
|
-
*
|
|
26
29
|
* @param options - A `ref`, plain value, or reactive getter resolving to the
|
|
27
30
|
* {@link UsePrefetchInfiniteQueryOptions} to use — everything you can pass to `queryClient.infiniteQuery`.
|
|
28
31
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`
|
|
29
32
|
* will be used.
|
|
30
|
-
* @returns `void` — nothing is returned.
|
|
31
|
-
*
|
|
32
33
|
* @example
|
|
33
34
|
* ```vue
|
|
34
35
|
* <script setup lang="ts">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePrefetchInfiniteQuery.d.cts","names":["QueryClient"],"sources":["../../src/usePrefetchInfiniteQuery.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"usePrefetchInfiniteQuery.d.cts","names":["QueryClient"],"sources":["../../src/usePrefetchInfiniteQuery.ts"],"mappings":";;;;;;;;YAmBY,gCACV,cACA,QACA,OACA,kBAAkB,UAClB,cACE,iBACF,4BACE,cACA,QACA,OACA,WACA;EAIF,UAAU,QACR,4BACE,cACA,QACA,OACA,WACA,wBAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAwDY,yBACd,wBACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,iBACP,aACE,gCACE,cACA,QACA,OACA,WACA,eAIN,cAAcA"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { o as MaybeRefDeep, s as MaybeRefOrGetter } from "./types-
|
|
2
|
-
import { t as QueryClient$1 } from "./queryClient-
|
|
1
|
+
import { o as MaybeRefDeep, s as MaybeRefOrGetter } from "./types-sdZdiLgo.js";
|
|
2
|
+
import { t as QueryClient$1 } from "./queryClient-BoBzDWAZ.js";
|
|
3
3
|
import { DefaultError, DistributiveOmit, InfiniteData, InfiniteQueryExecuteOptions, QueryKey, SkipToken } from "@tanstack/query-core";
|
|
4
4
|
//#region src/usePrefetchInfiniteQuery.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* The options accepted by `usePrefetchInfiniteQuery` — everything you can pass to `queryClient.infiniteQuery`,
|
|
7
|
+
* except that `queryFn` can't be `skipToken`.
|
|
8
|
+
*/
|
|
5
9
|
export type UsePrefetchInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey extends QueryKey, TPageParam> = DistributiveOmit<InfiniteQueryExecuteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'queryFn'> & {
|
|
6
10
|
queryFn?: Exclude<InfiniteQueryExecuteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>['queryFn'], SkipToken>;
|
|
7
11
|
};
|
|
@@ -22,13 +26,10 @@ export type UsePrefetchInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryK
|
|
|
22
26
|
*
|
|
23
27
|
* Fire this during render, before a suspense boundary that wraps a component using `useInfiniteQuery`'s
|
|
24
28
|
* `suspense()` — see the {@link https://tanstack.com/query/latest/docs/framework/vue/guides/suspense | Suspense guide}.
|
|
25
|
-
*
|
|
26
29
|
* @param options - A `ref`, plain value, or reactive getter resolving to the
|
|
27
30
|
* {@link UsePrefetchInfiniteQueryOptions} to use — everything you can pass to `queryClient.infiniteQuery`.
|
|
28
31
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`
|
|
29
32
|
* will be used.
|
|
30
|
-
* @returns `void` — nothing is returned.
|
|
31
|
-
*
|
|
32
33
|
* @example
|
|
33
34
|
* ```vue
|
|
34
35
|
* <script setup lang="ts">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePrefetchInfiniteQuery.d.ts","names":["QueryClient"],"sources":["../../src/usePrefetchInfiniteQuery.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"usePrefetchInfiniteQuery.d.ts","names":["QueryClient"],"sources":["../../src/usePrefetchInfiniteQuery.ts"],"mappings":";;;;;;;;YAmBY,gCACV,cACA,QACA,OACA,kBAAkB,UAClB,cACE,iBACF,4BACE,cACA,QACA,OACA,WACA;EAIF,UAAU,QACR,4BACE,cACA,QACA,OACA,WACA,wBAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAwDY,yBACd,wBACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,iBACP,aACE,gCACE,cACA,QACA,OACA,WACA,eAIN,cAAcA"}
|
|
@@ -3,6 +3,11 @@ import { useQueryClient } from "./useQueryClient.js";
|
|
|
3
3
|
import { noop } from "@tanstack/query-core";
|
|
4
4
|
import { getCurrentScope, unref, watchEffect } from "vue-demi";
|
|
5
5
|
//#region src/usePrefetchInfiniteQuery.ts
|
|
6
|
+
/**
|
|
7
|
+
* Checks whether an option was passed as a getter function.
|
|
8
|
+
* @param value - The option value.
|
|
9
|
+
* @returns `true` if `value` is a function.
|
|
10
|
+
*/
|
|
6
11
|
function isGetter(value) {
|
|
7
12
|
return typeof value === "function";
|
|
8
13
|
}
|
|
@@ -23,13 +28,10 @@ function isGetter(value) {
|
|
|
23
28
|
*
|
|
24
29
|
* Fire this during render, before a suspense boundary that wraps a component using `useInfiniteQuery`'s
|
|
25
30
|
* `suspense()` — see the {@link https://tanstack.com/query/latest/docs/framework/vue/guides/suspense | Suspense guide}.
|
|
26
|
-
*
|
|
27
31
|
* @param options - A `ref`, plain value, or reactive getter resolving to the
|
|
28
32
|
* {@link UsePrefetchInfiniteQueryOptions} to use — everything you can pass to `queryClient.infiniteQuery`.
|
|
29
33
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`
|
|
30
34
|
* will be used.
|
|
31
|
-
* @returns `void` — nothing is returned.
|
|
32
|
-
*
|
|
33
35
|
* @example
|
|
34
36
|
* ```vue
|
|
35
37
|
* <script setup lang="ts">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePrefetchInfiniteQuery.js","names":[],"sources":["../../src/usePrefetchInfiniteQuery.ts"],"sourcesContent":["import { getCurrentScope, unref, watchEffect } from 'vue-demi'\nimport { noop } from '@tanstack/query-core'\nimport { useQueryClient } from './useQueryClient'\nimport { cloneDeepUnref } from './utils'\nimport type {\n DefaultError,\n DistributiveOmit,\n InfiniteData,\n InfiniteQueryExecuteOptions,\n QueryKey,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { QueryClient } from './queryClient'\nimport type { MaybeRefDeep, MaybeRefOrGetter } from './types'\n\nexport type UsePrefetchInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey extends QueryKey,\n TPageParam,\n> = DistributiveOmit<\n InfiniteQueryExecuteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n 'queryFn'\n> & {\n queryFn?: Exclude<\n InfiniteQueryExecuteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >['queryFn'],\n SkipToken\n >\n}\n\nfunction isGetter<T>(value: MaybeRefOrGetter<T>): value is () => T {\n return typeof value === 'function'\n}\n\n/**\n * `usePrefetchInfiniteQuery` does not return anything — it fires a prefetch as a reactive side effect, useful\n * for kicking off a fetch ahead of the component that will actually render the data with `useInfiniteQuery`.\n * You can pass everything to `usePrefetchInfiniteQuery` that you can pass to `queryClient.infiniteQuery`,\n * though `queryKey`, `initialPageParam`, and `getNextPageParam` are always required, and `queryFn` is required\n * unless a default query function has been defined.\n *\n * `getNextPageParam` receives both the last page of the infinite list of data and the full array of all pages,\n * as well as pageParam information, and should return a single variable that will be passed to your query\n * function as `context.pageParam`. Return `undefined` or `null` to indicate there is no next page available.\n *\n * The prefetch is skipped if the query already has any cached state — including a `pending`/`error` state left\n * over from a previous attempt — so it won't refetch data that's already there or already in flight. It\n * re-runs whenever a reactive dependency in `options` (built with `infiniteQueryOptions`, for example) changes.\n *\n * Fire this during render, before a suspense boundary that wraps a component using `useInfiniteQuery`'s\n * `suspense()` — see the {@link https://tanstack.com/query/latest/docs/framework/vue/guides/suspense | Suspense guide}.\n
|
|
1
|
+
{"version":3,"file":"usePrefetchInfiniteQuery.js","names":[],"sources":["../../src/usePrefetchInfiniteQuery.ts"],"sourcesContent":["import { getCurrentScope, unref, watchEffect } from 'vue-demi'\nimport { noop } from '@tanstack/query-core'\nimport { useQueryClient } from './useQueryClient'\nimport { cloneDeepUnref } from './utils'\nimport type {\n DefaultError,\n DistributiveOmit,\n InfiniteData,\n InfiniteQueryExecuteOptions,\n QueryKey,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { QueryClient } from './queryClient'\nimport type { MaybeRefDeep, MaybeRefOrGetter } from './types'\n\n/**\n * The options accepted by `usePrefetchInfiniteQuery` — everything you can pass to `queryClient.infiniteQuery`,\n * except that `queryFn` can't be `skipToken`.\n */\nexport type UsePrefetchInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey extends QueryKey,\n TPageParam,\n> = DistributiveOmit<\n InfiniteQueryExecuteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n 'queryFn'\n> & {\n queryFn?: Exclude<\n InfiniteQueryExecuteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >['queryFn'],\n SkipToken\n >\n}\n\n/**\n * Checks whether an option was passed as a getter function.\n * @param value - The option value.\n * @returns `true` if `value` is a function.\n */\nfunction isGetter<T>(value: MaybeRefOrGetter<T>): value is () => T {\n return typeof value === 'function'\n}\n\n/**\n * `usePrefetchInfiniteQuery` does not return anything — it fires a prefetch as a reactive side effect, useful\n * for kicking off a fetch ahead of the component that will actually render the data with `useInfiniteQuery`.\n * You can pass everything to `usePrefetchInfiniteQuery` that you can pass to `queryClient.infiniteQuery`,\n * though `queryKey`, `initialPageParam`, and `getNextPageParam` are always required, and `queryFn` is required\n * unless a default query function has been defined.\n *\n * `getNextPageParam` receives both the last page of the infinite list of data and the full array of all pages,\n * as well as pageParam information, and should return a single variable that will be passed to your query\n * function as `context.pageParam`. Return `undefined` or `null` to indicate there is no next page available.\n *\n * The prefetch is skipped if the query already has any cached state — including a `pending`/`error` state left\n * over from a previous attempt — so it won't refetch data that's already there or already in flight. It\n * re-runs whenever a reactive dependency in `options` (built with `infiniteQueryOptions`, for example) changes.\n *\n * Fire this during render, before a suspense boundary that wraps a component using `useInfiniteQuery`'s\n * `suspense()` — see the {@link https://tanstack.com/query/latest/docs/framework/vue/guides/suspense | Suspense guide}.\n * @param options - A `ref`, plain value, or reactive getter resolving to the\n * {@link UsePrefetchInfiniteQueryOptions} to use — everything you can pass to `queryClient.infiniteQuery`.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`\n * will be used.\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { infiniteQueryOptions, usePrefetchInfiniteQuery } from '@tanstack/vue-query'\n * import Projects from './Projects.vue'\n *\n * const projectsOptions = infiniteQueryOptions({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n *\n * // Fire the prefetch as soon as this component runs, before `Projects` mounts and calls `useInfiniteQuery`.\n * usePrefetchInfiniteQuery(projectsOptions)\n * </script>\n *\n * <template>\n * <Projects />\n * </template>\n * ```\n */\nexport function usePrefetchInfiniteQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: MaybeRefOrGetter<\n MaybeRefDeep<\n UsePrefetchInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >\n >\n >,\n queryClient?: QueryClient,\n): void {\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 watchEffect(() => {\n const resolvedOptions = isGetter(options) ? options() : unref(options)\n\n const clonedOptions: UsePrefetchInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n > = cloneDeepUnref(resolvedOptions)\n\n if (!client.getQueryState(clonedOptions.queryKey)) {\n void client.infiniteQuery(clonedOptions).then(noop).catch(noop)\n }\n })\n}\n"],"mappings":";;;;;;;;;;AAoDA,SAAS,SAAY,OAA8C;CACjE,OAAO,OAAO,UAAU;AAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,SAAgB,yBAOd,SAWA,aACM;CACN,IAAI,QAAQ,IAAI,aAAa,eACvB;MAAA,CAAC,gBAAgB,GACnB,QAAQ,KACN,kKACF;CAAA;CAIJ,MAAM,SAAS,eAAe,eAAe;CAE7C,kBAAkB;EAChB,MAAM,kBAAkB,SAAS,OAAO,IAAI,QAAQ,IAAI,MAAM,OAAO;EAErE,MAAM,gBAMF,eAAe,eAAe;EAElC,IAAI,CAAC,OAAO,cAAc,cAAc,QAAQ,GAC9C,OAAY,cAAc,aAAa,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,IAAI;CAElE,CAAC;AACH"}
|
|
@@ -4,6 +4,11 @@ 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
|
//#region src/usePrefetchQuery.ts
|
|
7
|
+
/**
|
|
8
|
+
* Checks whether an option was passed as a getter function.
|
|
9
|
+
* @param value - The option value.
|
|
10
|
+
* @returns `true` if `value` is a function.
|
|
11
|
+
*/
|
|
7
12
|
function isGetter(value) {
|
|
8
13
|
return typeof value === "function";
|
|
9
14
|
}
|
|
@@ -19,13 +24,10 @@ function isGetter(value) {
|
|
|
19
24
|
*
|
|
20
25
|
* Fire this during render, before a suspense boundary that wraps a component using `useQuery`'s `suspense()`
|
|
21
26
|
* — see the {@link https://tanstack.com/query/latest/docs/framework/vue/guides/suspense | Suspense guide}.
|
|
22
|
-
*
|
|
23
27
|
* @param options - A `ref`, plain value, or reactive getter resolving to the {@link UsePrefetchQueryOptions} to
|
|
24
28
|
* use — everything you can pass to `queryClient.query`.
|
|
25
29
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`
|
|
26
30
|
* will be used.
|
|
27
|
-
* @returns `void` — nothing is returned.
|
|
28
|
-
*
|
|
29
31
|
* @example
|
|
30
32
|
* ```vue
|
|
31
33
|
* <script setup lang="ts">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePrefetchQuery.cjs","names":["getCurrentScope","useQueryClient","unref","cloneDeepUnref","noop"],"sources":["../../src/usePrefetchQuery.ts"],"sourcesContent":["import { getCurrentScope, unref, watchEffect } from 'vue-demi'\nimport { noop } from '@tanstack/query-core'\nimport { useQueryClient } from './useQueryClient'\nimport { cloneDeepUnref } from './utils'\nimport type {\n DefaultError,\n OmitKeyof,\n QueryExecuteOptions,\n QueryKey,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { QueryClient } from './queryClient'\nimport type { MaybeRefDeep, MaybeRefOrGetter } from './types'\n\nexport type UsePrefetchQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n> = OmitKeyof<\n QueryExecuteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n never\n >,\n 'queryFn'\n> & {\n queryFn?: Exclude<\n QueryExecuteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n never\n >['queryFn'],\n SkipToken\n >\n}\n\nfunction isGetter<T>(value: MaybeRefOrGetter<T>): value is () => T {\n return typeof value === 'function'\n}\n\n/**\n * `usePrefetchQuery` does not return anything — it fires a prefetch as a reactive side effect, useful for\n * kicking off a fetch ahead of the component that will actually render the data with `useQuery`. You can pass\n * everything to `usePrefetchQuery` that you can pass to `queryClient.query`, though `queryKey` is always\n * required, and `queryFn` is required unless a default query function has been defined.\n *\n * The prefetch is skipped if the query already has any cached state — including a `pending`/`error` state left\n * over from a previous attempt — so it won't refetch data that's already there or already in flight. It\n * re-runs whenever a reactive dependency in `options` (built with `queryOptions`, for example) changes.\n *\n * Fire this during render, before a suspense boundary that wraps a component using `useQuery`'s `suspense()`\n * — see the {@link https://tanstack.com/query/latest/docs/framework/vue/guides/suspense | Suspense guide}.\n
|
|
1
|
+
{"version":3,"file":"usePrefetchQuery.cjs","names":["getCurrentScope","useQueryClient","unref","cloneDeepUnref","noop"],"sources":["../../src/usePrefetchQuery.ts"],"sourcesContent":["import { getCurrentScope, unref, watchEffect } from 'vue-demi'\nimport { noop } from '@tanstack/query-core'\nimport { useQueryClient } from './useQueryClient'\nimport { cloneDeepUnref } from './utils'\nimport type {\n DefaultError,\n OmitKeyof,\n QueryExecuteOptions,\n QueryKey,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { QueryClient } from './queryClient'\nimport type { MaybeRefDeep, MaybeRefOrGetter } from './types'\n\n/**\n * The options accepted by `usePrefetchQuery` — everything you can pass to `queryClient.query`, except that\n * `queryFn` can't be `skipToken`.\n */\nexport type UsePrefetchQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n> = OmitKeyof<\n QueryExecuteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n never\n >,\n 'queryFn'\n> & {\n queryFn?: Exclude<\n QueryExecuteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n never\n >['queryFn'],\n SkipToken\n >\n}\n\n/**\n * Checks whether an option was passed as a getter function.\n * @param value - The option value.\n * @returns `true` if `value` is a function.\n */\nfunction isGetter<T>(value: MaybeRefOrGetter<T>): value is () => T {\n return typeof value === 'function'\n}\n\n/**\n * `usePrefetchQuery` does not return anything — it fires a prefetch as a reactive side effect, useful for\n * kicking off a fetch ahead of the component that will actually render the data with `useQuery`. You can pass\n * everything to `usePrefetchQuery` that you can pass to `queryClient.query`, though `queryKey` is always\n * required, and `queryFn` is required unless a default query function has been defined.\n *\n * The prefetch is skipped if the query already has any cached state — including a `pending`/`error` state left\n * over from a previous attempt — so it won't refetch data that's already there or already in flight. It\n * re-runs whenever a reactive dependency in `options` (built with `queryOptions`, for example) changes.\n *\n * Fire this during render, before a suspense boundary that wraps a component using `useQuery`'s `suspense()`\n * — see the {@link https://tanstack.com/query/latest/docs/framework/vue/guides/suspense | Suspense guide}.\n * @param options - A `ref`, plain value, or reactive getter resolving to the {@link UsePrefetchQueryOptions} to\n * use — everything you can pass to `queryClient.query`.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`\n * will be used.\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { usePrefetchQuery } from '@tanstack/vue-query'\n * import Posts from './Posts.vue'\n *\n * // Fire the prefetch as soon as this component runs, before `Posts` mounts and calls `useQuery`.\n * usePrefetchQuery({\n * queryKey: ['posts'],\n * queryFn: fetchPosts,\n * })\n * </script>\n *\n * <template>\n * <Posts />\n * </template>\n * ```\n */\nexport function usePrefetchQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: MaybeRefOrGetter<\n MaybeRefDeep<\n UsePrefetchQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >\n >\n >,\n queryClient?: QueryClient,\n): void {\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 watchEffect(() => {\n const resolvedOptions = isGetter(options) ? options() : unref(options)\n const clonedOptions: UsePrefetchQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n > = cloneDeepUnref(resolvedOptions)\n\n if (!client.getQueryState(clonedOptions.queryKey)) {\n void client.query(clonedOptions).catch(noop)\n }\n })\n}\n"],"mappings":";;;;;;;;;;;AAqDA,SAAS,SAAY,OAA8C;CACjE,OAAO,OAAO,UAAU;AAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,SAAgB,iBAOd,SAWA,aACM;CACN,IAAI,QAAQ,IAAI,aAAa,eACvB;MAAA,EAAA,GAACA,SAAAA,gBAAAA,CAAgB,GACnB,QAAQ,KACN,kKACF;CAAA;CAIJ,MAAM,SAAS,eAAeC,uBAAAA,eAAe;CAE7C,CAAA,GAAA,SAAA,YAAA,OAAkB;EAChB,MAAM,kBAAkB,SAAS,OAAO,IAAI,QAAQ,KAAA,GAAIC,SAAAA,MAAAA,CAAM,OAAO;EACrE,MAAM,gBAMFC,cAAAA,eAAe,eAAe;EAElC,IAAI,CAAC,OAAO,cAAc,cAAc,QAAQ,GAC9C,OAAY,MAAM,aAAa,CAAC,CAAC,MAAMC,qBAAAA,IAAI;CAE/C,CAAC;AACH"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { o as MaybeRefDeep, s as MaybeRefOrGetter } from "./types-
|
|
2
|
-
import { t as QueryClient$1 } from "./queryClient-
|
|
1
|
+
import { o as MaybeRefDeep, s as MaybeRefOrGetter } from "./types-sdZdiLgo.cjs";
|
|
2
|
+
import { t as QueryClient$1 } from "./queryClient-BK9W57Qu.cjs";
|
|
3
3
|
import { DefaultError, OmitKeyof, QueryExecuteOptions, QueryKey, SkipToken } from "@tanstack/query-core";
|
|
4
4
|
//#region src/usePrefetchQuery.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* The options accepted by `usePrefetchQuery` — everything you can pass to `queryClient.query`, except that
|
|
7
|
+
* `queryFn` can't be `skipToken`.
|
|
8
|
+
*/
|
|
5
9
|
export type UsePrefetchQueryOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey> = OmitKeyof<QueryExecuteOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey, never>, 'queryFn'> & {
|
|
6
10
|
queryFn?: Exclude<QueryExecuteOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey, never>['queryFn'], SkipToken>;
|
|
7
11
|
};
|
|
@@ -17,13 +21,10 @@ export type UsePrefetchQueryOptions<TQueryFnData, TError, TData, TQueryData, TQu
|
|
|
17
21
|
*
|
|
18
22
|
* Fire this during render, before a suspense boundary that wraps a component using `useQuery`'s `suspense()`
|
|
19
23
|
* — see the {@link https://tanstack.com/query/latest/docs/framework/vue/guides/suspense | Suspense guide}.
|
|
20
|
-
*
|
|
21
24
|
* @param options - A `ref`, plain value, or reactive getter resolving to the {@link UsePrefetchQueryOptions} to
|
|
22
25
|
* use — everything you can pass to `queryClient.query`.
|
|
23
26
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`
|
|
24
27
|
* will be used.
|
|
25
|
-
* @returns `void` — nothing is returned.
|
|
26
|
-
*
|
|
27
28
|
* @example
|
|
28
29
|
* ```vue
|
|
29
30
|
* <script setup lang="ts">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePrefetchQuery.d.cts","names":["QueryClient"],"sources":["../../src/usePrefetchQuery.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"usePrefetchQuery.d.cts","names":["QueryClient"],"sources":["../../src/usePrefetchQuery.ts"],"mappings":";;;;;;;;YAkBY,wBACV,cACA,QACA,OACA,YACA,kBAAkB,YAChB,UACF,oBACE,cACA,QACA,OACA,YACA;EAKF,UAAU,QACR,oBACE,cACA,QACA,OACA,YACA,8BAGF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA+CY,iBACd,wBACA,SAAS,cACT,QAAQ,cACR,aAAa,cACb,kBAAkB,WAAW,UAE7B,SAAS,iBACP,aACE,wBACE,cACA,QACA,OACA,YACA,cAIN,cAAcA"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { o as MaybeRefDeep, s as MaybeRefOrGetter } from "./types-
|
|
2
|
-
import { t as QueryClient$1 } from "./queryClient-
|
|
1
|
+
import { o as MaybeRefDeep, s as MaybeRefOrGetter } from "./types-sdZdiLgo.js";
|
|
2
|
+
import { t as QueryClient$1 } from "./queryClient-BoBzDWAZ.js";
|
|
3
3
|
import { DefaultError, OmitKeyof, QueryExecuteOptions, QueryKey, SkipToken } from "@tanstack/query-core";
|
|
4
4
|
//#region src/usePrefetchQuery.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* The options accepted by `usePrefetchQuery` — everything you can pass to `queryClient.query`, except that
|
|
7
|
+
* `queryFn` can't be `skipToken`.
|
|
8
|
+
*/
|
|
5
9
|
export type UsePrefetchQueryOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey> = OmitKeyof<QueryExecuteOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey, never>, 'queryFn'> & {
|
|
6
10
|
queryFn?: Exclude<QueryExecuteOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey, never>['queryFn'], SkipToken>;
|
|
7
11
|
};
|
|
@@ -17,13 +21,10 @@ export type UsePrefetchQueryOptions<TQueryFnData, TError, TData, TQueryData, TQu
|
|
|
17
21
|
*
|
|
18
22
|
* Fire this during render, before a suspense boundary that wraps a component using `useQuery`'s `suspense()`
|
|
19
23
|
* — see the {@link https://tanstack.com/query/latest/docs/framework/vue/guides/suspense | Suspense guide}.
|
|
20
|
-
*
|
|
21
24
|
* @param options - A `ref`, plain value, or reactive getter resolving to the {@link UsePrefetchQueryOptions} to
|
|
22
25
|
* use — everything you can pass to `queryClient.query`.
|
|
23
26
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`
|
|
24
27
|
* will be used.
|
|
25
|
-
* @returns `void` — nothing is returned.
|
|
26
|
-
*
|
|
27
28
|
* @example
|
|
28
29
|
* ```vue
|
|
29
30
|
* <script setup lang="ts">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePrefetchQuery.d.ts","names":["QueryClient"],"sources":["../../src/usePrefetchQuery.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"usePrefetchQuery.d.ts","names":["QueryClient"],"sources":["../../src/usePrefetchQuery.ts"],"mappings":";;;;;;;;YAkBY,wBACV,cACA,QACA,OACA,YACA,kBAAkB,YAChB,UACF,oBACE,cACA,QACA,OACA,YACA;EAKF,UAAU,QACR,oBACE,cACA,QACA,OACA,YACA,8BAGF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA+CY,iBACd,wBACA,SAAS,cACT,QAAQ,cACR,aAAa,cACb,kBAAkB,WAAW,UAE7B,SAAS,iBACP,aACE,wBACE,cACA,QACA,OACA,YACA,cAIN,cAAcA"}
|
|
@@ -3,6 +3,11 @@ import { useQueryClient } from "./useQueryClient.js";
|
|
|
3
3
|
import { noop } from "@tanstack/query-core";
|
|
4
4
|
import { getCurrentScope, unref, watchEffect } from "vue-demi";
|
|
5
5
|
//#region src/usePrefetchQuery.ts
|
|
6
|
+
/**
|
|
7
|
+
* Checks whether an option was passed as a getter function.
|
|
8
|
+
* @param value - The option value.
|
|
9
|
+
* @returns `true` if `value` is a function.
|
|
10
|
+
*/
|
|
6
11
|
function isGetter(value) {
|
|
7
12
|
return typeof value === "function";
|
|
8
13
|
}
|
|
@@ -18,13 +23,10 @@ function isGetter(value) {
|
|
|
18
23
|
*
|
|
19
24
|
* Fire this during render, before a suspense boundary that wraps a component using `useQuery`'s `suspense()`
|
|
20
25
|
* — see the {@link https://tanstack.com/query/latest/docs/framework/vue/guides/suspense | Suspense guide}.
|
|
21
|
-
*
|
|
22
26
|
* @param options - A `ref`, plain value, or reactive getter resolving to the {@link UsePrefetchQueryOptions} to
|
|
23
27
|
* use — everything you can pass to `queryClient.query`.
|
|
24
28
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`
|
|
25
29
|
* will be used.
|
|
26
|
-
* @returns `void` — nothing is returned.
|
|
27
|
-
*
|
|
28
30
|
* @example
|
|
29
31
|
* ```vue
|
|
30
32
|
* <script setup lang="ts">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePrefetchQuery.js","names":[],"sources":["../../src/usePrefetchQuery.ts"],"sourcesContent":["import { getCurrentScope, unref, watchEffect } from 'vue-demi'\nimport { noop } from '@tanstack/query-core'\nimport { useQueryClient } from './useQueryClient'\nimport { cloneDeepUnref } from './utils'\nimport type {\n DefaultError,\n OmitKeyof,\n QueryExecuteOptions,\n QueryKey,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { QueryClient } from './queryClient'\nimport type { MaybeRefDeep, MaybeRefOrGetter } from './types'\n\nexport type UsePrefetchQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n> = OmitKeyof<\n QueryExecuteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n never\n >,\n 'queryFn'\n> & {\n queryFn?: Exclude<\n QueryExecuteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n never\n >['queryFn'],\n SkipToken\n >\n}\n\nfunction isGetter<T>(value: MaybeRefOrGetter<T>): value is () => T {\n return typeof value === 'function'\n}\n\n/**\n * `usePrefetchQuery` does not return anything — it fires a prefetch as a reactive side effect, useful for\n * kicking off a fetch ahead of the component that will actually render the data with `useQuery`. You can pass\n * everything to `usePrefetchQuery` that you can pass to `queryClient.query`, though `queryKey` is always\n * required, and `queryFn` is required unless a default query function has been defined.\n *\n * The prefetch is skipped if the query already has any cached state — including a `pending`/`error` state left\n * over from a previous attempt — so it won't refetch data that's already there or already in flight. It\n * re-runs whenever a reactive dependency in `options` (built with `queryOptions`, for example) changes.\n *\n * Fire this during render, before a suspense boundary that wraps a component using `useQuery`'s `suspense()`\n * — see the {@link https://tanstack.com/query/latest/docs/framework/vue/guides/suspense | Suspense guide}.\n
|
|
1
|
+
{"version":3,"file":"usePrefetchQuery.js","names":[],"sources":["../../src/usePrefetchQuery.ts"],"sourcesContent":["import { getCurrentScope, unref, watchEffect } from 'vue-demi'\nimport { noop } from '@tanstack/query-core'\nimport { useQueryClient } from './useQueryClient'\nimport { cloneDeepUnref } from './utils'\nimport type {\n DefaultError,\n OmitKeyof,\n QueryExecuteOptions,\n QueryKey,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { QueryClient } from './queryClient'\nimport type { MaybeRefDeep, MaybeRefOrGetter } from './types'\n\n/**\n * The options accepted by `usePrefetchQuery` — everything you can pass to `queryClient.query`, except that\n * `queryFn` can't be `skipToken`.\n */\nexport type UsePrefetchQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n> = OmitKeyof<\n QueryExecuteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n never\n >,\n 'queryFn'\n> & {\n queryFn?: Exclude<\n QueryExecuteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n never\n >['queryFn'],\n SkipToken\n >\n}\n\n/**\n * Checks whether an option was passed as a getter function.\n * @param value - The option value.\n * @returns `true` if `value` is a function.\n */\nfunction isGetter<T>(value: MaybeRefOrGetter<T>): value is () => T {\n return typeof value === 'function'\n}\n\n/**\n * `usePrefetchQuery` does not return anything — it fires a prefetch as a reactive side effect, useful for\n * kicking off a fetch ahead of the component that will actually render the data with `useQuery`. You can pass\n * everything to `usePrefetchQuery` that you can pass to `queryClient.query`, though `queryKey` is always\n * required, and `queryFn` is required unless a default query function has been defined.\n *\n * The prefetch is skipped if the query already has any cached state — including a `pending`/`error` state left\n * over from a previous attempt — so it won't refetch data that's already there or already in flight. It\n * re-runs whenever a reactive dependency in `options` (built with `queryOptions`, for example) changes.\n *\n * Fire this during render, before a suspense boundary that wraps a component using `useQuery`'s `suspense()`\n * — see the {@link https://tanstack.com/query/latest/docs/framework/vue/guides/suspense | Suspense guide}.\n * @param options - A `ref`, plain value, or reactive getter resolving to the {@link UsePrefetchQueryOptions} to\n * use — everything you can pass to `queryClient.query`.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`\n * will be used.\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { usePrefetchQuery } from '@tanstack/vue-query'\n * import Posts from './Posts.vue'\n *\n * // Fire the prefetch as soon as this component runs, before `Posts` mounts and calls `useQuery`.\n * usePrefetchQuery({\n * queryKey: ['posts'],\n * queryFn: fetchPosts,\n * })\n * </script>\n *\n * <template>\n * <Posts />\n * </template>\n * ```\n */\nexport function usePrefetchQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: MaybeRefOrGetter<\n MaybeRefDeep<\n UsePrefetchQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >\n >\n >,\n queryClient?: QueryClient,\n): void {\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 watchEffect(() => {\n const resolvedOptions = isGetter(options) ? options() : unref(options)\n const clonedOptions: UsePrefetchQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n > = cloneDeepUnref(resolvedOptions)\n\n if (!client.getQueryState(clonedOptions.queryKey)) {\n void client.query(clonedOptions).catch(noop)\n }\n })\n}\n"],"mappings":";;;;;;;;;;AAqDA,SAAS,SAAY,OAA8C;CACjE,OAAO,OAAO,UAAU;AAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,SAAgB,iBAOd,SAWA,aACM;CACN,IAAI,QAAQ,IAAI,aAAa,eACvB;MAAA,CAAC,gBAAgB,GACnB,QAAQ,KACN,kKACF;CAAA;CAIJ,MAAM,SAAS,eAAe,eAAe;CAE7C,kBAAkB;EAChB,MAAM,kBAAkB,SAAS,OAAO,IAAI,QAAQ,IAAI,MAAM,OAAO;EACrE,MAAM,gBAMF,eAAe,eAAe;EAElC,IAAI,CAAC,OAAO,cAAc,cAAc,QAAQ,GAC9C,OAAY,MAAM,aAAa,CAAC,CAAC,MAAM,IAAI;CAE/C,CAAC;AACH"}
|
|
@@ -20,12 +20,11 @@ let vue_demi = require("vue-demi");
|
|
|
20
20
|
*
|
|
21
21
|
* `placeholderData` is supported here too, but unlike `useQuery`, it doesn't receive information from
|
|
22
22
|
* previously rendered queries, because the number of queries can differ between renders.
|
|
23
|
-
*
|
|
23
|
+
* @param options - The `queries` array to run, and the optional `combine` and `shallow` options.
|
|
24
24
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`
|
|
25
25
|
* will be used.
|
|
26
26
|
* @returns A `ref` to the combined result. Without `combine`, this is an array with all the query results, in
|
|
27
27
|
* the same order as the input. When `combine` is provided, this is the value returned by `combine` instead.
|
|
28
|
-
*
|
|
29
28
|
* @example
|
|
30
29
|
* ```vue
|
|
31
30
|
* <script setup lang="ts">
|
|
@@ -53,7 +52,6 @@ let vue_demi = require("vue-demi");
|
|
|
53
52
|
* </ul>
|
|
54
53
|
* </template>
|
|
55
54
|
* ```
|
|
56
|
-
*
|
|
57
55
|
* @example
|
|
58
56
|
* Combining results into a single value:
|
|
59
57
|
* ```vue
|
|
@@ -84,7 +82,6 @@ let vue_demi = require("vue-demi");
|
|
|
84
82
|
* </ul>
|
|
85
83
|
* </template>
|
|
86
84
|
* ```
|
|
87
|
-
*
|
|
88
85
|
* @example
|
|
89
86
|
* Typing `select` via {@link queryOptions}. Note that spreading a `queryOptions` result and overriding
|
|
90
87
|
* `select` inline still falls back to `unknown` — wrap the spread in `queryOptions` again so the override is
|