@tanstack/vue-query 5.104.1 → 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 +4 -5
- 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
package/src/queryClient.ts
CHANGED
|
@@ -64,21 +64,24 @@ export class QueryClient extends QC {
|
|
|
64
64
|
*/
|
|
65
65
|
isRestoring?: Ref<boolean> = ref(false)
|
|
66
66
|
|
|
67
|
-
isFetching(filters: MaybeRefDeep<QueryFilters> = {}): number {
|
|
67
|
+
override isFetching(filters: MaybeRefDeep<QueryFilters> = {}): number {
|
|
68
68
|
return super.isFetching(cloneDeepUnref(filters))
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
isMutating(filters: MaybeRefDeep<MutationFilters> = {}): number {
|
|
71
|
+
override isMutating(filters: MaybeRefDeep<MutationFilters> = {}): number {
|
|
72
72
|
return super.isMutating(cloneDeepUnref(filters))
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
getQueryData<
|
|
75
|
+
override getQueryData<
|
|
76
|
+
TData = unknown,
|
|
77
|
+
TTaggedQueryKey extends QueryKey = QueryKey,
|
|
78
|
+
>(
|
|
76
79
|
queryKey: TTaggedQueryKey,
|
|
77
80
|
): InferDataFromTag<TData, TTaggedQueryKey> | undefined
|
|
78
|
-
getQueryData<TData = unknown>(
|
|
81
|
+
override getQueryData<TData = unknown>(
|
|
79
82
|
queryKey: MaybeRefDeep<QueryKey>,
|
|
80
83
|
): TData | undefined
|
|
81
|
-
getQueryData<TData = unknown>(
|
|
84
|
+
override getQueryData<TData = unknown>(
|
|
82
85
|
queryKey: MaybeRefDeep<QueryKey>,
|
|
83
86
|
): TData | undefined {
|
|
84
87
|
return super.getQueryData(cloneDeepUnref(queryKey))
|
|
@@ -87,7 +90,7 @@ export class QueryClient extends QC {
|
|
|
87
90
|
/**
|
|
88
91
|
* @deprecated Use queryClient.query({ ...options, staleTime: 'static' }) instead. This method will be removed in the next major version.
|
|
89
92
|
*/
|
|
90
|
-
ensureQueryData<
|
|
93
|
+
override ensureQueryData<
|
|
91
94
|
TQueryFnData,
|
|
92
95
|
TError = DefaultError,
|
|
93
96
|
TData = TQueryFnData,
|
|
@@ -95,7 +98,7 @@ export class QueryClient extends QC {
|
|
|
95
98
|
>(
|
|
96
99
|
options: EnsureQueryDataOptions<TQueryFnData, TError, TData, TQueryKey>,
|
|
97
100
|
): Promise<TData>
|
|
98
|
-
ensureQueryData<
|
|
101
|
+
override ensureQueryData<
|
|
99
102
|
TQueryFnData,
|
|
100
103
|
TError = DefaultError,
|
|
101
104
|
TData = TQueryFnData,
|
|
@@ -105,7 +108,7 @@ export class QueryClient extends QC {
|
|
|
105
108
|
EnsureQueryDataOptions<TQueryFnData, TError, TData, TQueryKey>
|
|
106
109
|
>,
|
|
107
110
|
): Promise<TData>
|
|
108
|
-
ensureQueryData<
|
|
111
|
+
override ensureQueryData<
|
|
109
112
|
TQueryFnData,
|
|
110
113
|
TError = DefaultError,
|
|
111
114
|
TData = TQueryFnData,
|
|
@@ -115,17 +118,17 @@ export class QueryClient extends QC {
|
|
|
115
118
|
EnsureQueryDataOptions<TQueryFnData, TError, TData, TQueryKey>
|
|
116
119
|
>,
|
|
117
120
|
): Promise<TData> {
|
|
118
|
-
//
|
|
121
|
+
// oxlint-disable-next-line tanstack-query/no-restricted-syntax -- grandfathered deprecated wrapper implementation
|
|
119
122
|
return super.ensureQueryData(cloneDeepUnref(options))
|
|
120
123
|
}
|
|
121
124
|
|
|
122
|
-
getQueriesData<TData = unknown>(
|
|
125
|
+
override getQueriesData<TData = unknown>(
|
|
123
126
|
filters: MaybeRefDeep<QueryFilters>,
|
|
124
127
|
): Array<[QueryKey, TData | undefined]> {
|
|
125
128
|
return super.getQueriesData(cloneDeepUnref(filters))
|
|
126
129
|
}
|
|
127
130
|
|
|
128
|
-
setQueryData<
|
|
131
|
+
override setQueryData<
|
|
129
132
|
TQueryFnData = unknown,
|
|
130
133
|
TTaggedQueryKey extends QueryKey = QueryKey,
|
|
131
134
|
TInferredQueryFnData = InferDataFromTag<TQueryFnData, TTaggedQueryKey>,
|
|
@@ -137,12 +140,12 @@ export class QueryClient extends QC {
|
|
|
137
140
|
>,
|
|
138
141
|
options?: MaybeRefDeep<SetDataOptions>,
|
|
139
142
|
): NoInfer<TInferredQueryFnData> | undefined
|
|
140
|
-
setQueryData<TQueryFnData, TData = NoUnknown<TQueryFnData>>(
|
|
143
|
+
override setQueryData<TQueryFnData, TData = NoUnknown<TQueryFnData>>(
|
|
141
144
|
queryKey: MaybeRefDeep<QueryKey>,
|
|
142
145
|
updater: Updater<NoInfer<TData> | undefined, NoInfer<TData> | undefined>,
|
|
143
146
|
options?: MaybeRefDeep<SetDataOptions>,
|
|
144
147
|
): NoInfer<TData> | undefined
|
|
145
|
-
setQueryData<TData>(
|
|
148
|
+
override setQueryData<TData>(
|
|
146
149
|
queryKey: MaybeRefDeep<QueryKey>,
|
|
147
150
|
updater: Updater<TData | undefined, TData | undefined>,
|
|
148
151
|
options: MaybeRefDeep<SetDataOptions> = {},
|
|
@@ -154,7 +157,7 @@ export class QueryClient extends QC {
|
|
|
154
157
|
)
|
|
155
158
|
}
|
|
156
159
|
|
|
157
|
-
setQueriesData<TData>(
|
|
160
|
+
override setQueriesData<TData>(
|
|
158
161
|
filters: MaybeRefDeep<QueryFilters>,
|
|
159
162
|
updater: Updater<TData | undefined, TData | undefined>,
|
|
160
163
|
options: MaybeRefDeep<SetDataOptions> = {},
|
|
@@ -166,48 +169,48 @@ export class QueryClient extends QC {
|
|
|
166
169
|
)
|
|
167
170
|
}
|
|
168
171
|
|
|
169
|
-
getQueryState<TData = unknown, TError = DefaultError>(
|
|
172
|
+
override getQueryState<TData = unknown, TError = DefaultError>(
|
|
170
173
|
queryKey: MaybeRefDeep<QueryKey>,
|
|
171
174
|
): QueryState<TData, TError> | undefined {
|
|
172
175
|
return super.getQueryState(cloneDeepUnref(queryKey))
|
|
173
176
|
}
|
|
174
177
|
|
|
175
|
-
removeQueries<TTaggedQueryKey extends QueryKey = QueryKey>(
|
|
178
|
+
override removeQueries<TTaggedQueryKey extends QueryKey = QueryKey>(
|
|
176
179
|
filters?: QueryFilters<TTaggedQueryKey>,
|
|
177
180
|
): void
|
|
178
|
-
removeQueries(filters: MaybeRefDeep<QueryFilters> = {}): void {
|
|
181
|
+
override removeQueries(filters: MaybeRefDeep<QueryFilters> = {}): void {
|
|
179
182
|
return super.removeQueries(cloneDeepUnref(filters))
|
|
180
183
|
}
|
|
181
184
|
|
|
182
|
-
resetQueries<TTaggedQueryKey extends QueryKey = QueryKey>(
|
|
185
|
+
override resetQueries<TTaggedQueryKey extends QueryKey = QueryKey>(
|
|
183
186
|
filters?: QueryFilters<TTaggedQueryKey>,
|
|
184
187
|
options?: MaybeRefDeep<ResetOptions>,
|
|
185
188
|
): Promise<void>
|
|
186
|
-
resetQueries(
|
|
189
|
+
override resetQueries(
|
|
187
190
|
filters: MaybeRefDeep<QueryFilters> = {},
|
|
188
191
|
options: MaybeRefDeep<ResetOptions> = {},
|
|
189
192
|
): Promise<void> {
|
|
190
193
|
return super.resetQueries(cloneDeepUnref(filters), cloneDeepUnref(options))
|
|
191
194
|
}
|
|
192
195
|
|
|
193
|
-
cancelQueries<TTaggedQueryKey extends QueryKey = QueryKey>(
|
|
196
|
+
override cancelQueries<TTaggedQueryKey extends QueryKey = QueryKey>(
|
|
194
197
|
filters?: QueryFilters<TTaggedQueryKey>,
|
|
195
198
|
options?: MaybeRefDeep<CancelOptions>,
|
|
196
199
|
): Promise<void>
|
|
197
|
-
cancelQueries(
|
|
200
|
+
override cancelQueries(
|
|
198
201
|
filters: MaybeRefDeep<QueryFilters> = {},
|
|
199
202
|
options: MaybeRefDeep<CancelOptions> = {},
|
|
200
203
|
): Promise<void> {
|
|
201
204
|
return super.cancelQueries(cloneDeepUnref(filters), cloneDeepUnref(options))
|
|
202
205
|
}
|
|
203
206
|
|
|
204
|
-
invalidateQueries<TTaggedQueryKey extends QueryKey = QueryKey>(
|
|
207
|
+
override invalidateQueries<TTaggedQueryKey extends QueryKey = QueryKey>(
|
|
205
208
|
filters?:
|
|
206
209
|
| InvalidateQueryFilters<TTaggedQueryKey>
|
|
207
210
|
| (() => InvalidateQueryFilters<TTaggedQueryKey>),
|
|
208
211
|
options?: MaybeRefDeep<InvalidateOptions>,
|
|
209
212
|
): Promise<void>
|
|
210
|
-
invalidateQueries<TTaggedQueryKey extends QueryKey = QueryKey>(
|
|
213
|
+
override invalidateQueries<TTaggedQueryKey extends QueryKey = QueryKey>(
|
|
211
214
|
filters:
|
|
212
215
|
| MaybeRefDeep<InvalidateQueryFilters<TTaggedQueryKey>>
|
|
213
216
|
| (() => InvalidateQueryFilters<TTaggedQueryKey>) = {},
|
|
@@ -241,11 +244,11 @@ export class QueryClient extends QC {
|
|
|
241
244
|
})
|
|
242
245
|
}
|
|
243
246
|
|
|
244
|
-
refetchQueries<TTaggedQueryKey extends QueryKey = QueryKey>(
|
|
247
|
+
override refetchQueries<TTaggedQueryKey extends QueryKey = QueryKey>(
|
|
245
248
|
filters?: RefetchQueryFilters<TTaggedQueryKey>,
|
|
246
249
|
options?: MaybeRefDeep<RefetchOptions>,
|
|
247
250
|
): Promise<void>
|
|
248
|
-
refetchQueries(
|
|
251
|
+
override refetchQueries(
|
|
249
252
|
filters: MaybeRefDeep<RefetchQueryFilters> = {},
|
|
250
253
|
options: MaybeRefDeep<RefetchOptions> = {},
|
|
251
254
|
): Promise<void> {
|
|
@@ -257,7 +260,7 @@ export class QueryClient extends QC {
|
|
|
257
260
|
|
|
258
261
|
// These one-shot imperative methods do not resolve top-level option getters.
|
|
259
262
|
// Resolve getters explicitly before calling, e.g. queryClient.query(options()).
|
|
260
|
-
query<
|
|
263
|
+
override query<
|
|
261
264
|
TQueryFnData,
|
|
262
265
|
TError = DefaultError,
|
|
263
266
|
TData = TQueryFnData,
|
|
@@ -274,7 +277,7 @@ export class QueryClient extends QC {
|
|
|
274
277
|
TPageParam
|
|
275
278
|
>,
|
|
276
279
|
): Promise<TData>
|
|
277
|
-
query<
|
|
280
|
+
override query<
|
|
278
281
|
TQueryFnData,
|
|
279
282
|
TError = DefaultError,
|
|
280
283
|
TData = TQueryFnData,
|
|
@@ -293,7 +296,7 @@ export class QueryClient extends QC {
|
|
|
293
296
|
>
|
|
294
297
|
>,
|
|
295
298
|
): Promise<TData>
|
|
296
|
-
query<
|
|
299
|
+
override query<
|
|
297
300
|
TQueryFnData,
|
|
298
301
|
TError = DefaultError,
|
|
299
302
|
TData = TQueryFnData,
|
|
@@ -318,7 +321,7 @@ export class QueryClient extends QC {
|
|
|
318
321
|
/**
|
|
319
322
|
* @deprecated Use queryClient.query(options) instead. This method will be removed in the next major version.
|
|
320
323
|
*/
|
|
321
|
-
fetchQuery<
|
|
324
|
+
override fetchQuery<
|
|
322
325
|
TQueryFnData,
|
|
323
326
|
TError = DefaultError,
|
|
324
327
|
TData = TQueryFnData,
|
|
@@ -333,7 +336,7 @@ export class QueryClient extends QC {
|
|
|
333
336
|
TPageParam
|
|
334
337
|
>,
|
|
335
338
|
): Promise<TData>
|
|
336
|
-
fetchQuery<
|
|
339
|
+
override fetchQuery<
|
|
337
340
|
TQueryFnData,
|
|
338
341
|
TError = DefaultError,
|
|
339
342
|
TData = TQueryFnData,
|
|
@@ -352,7 +355,7 @@ export class QueryClient extends QC {
|
|
|
352
355
|
TPageParam
|
|
353
356
|
>),
|
|
354
357
|
): Promise<TData>
|
|
355
|
-
fetchQuery<
|
|
358
|
+
override fetchQuery<
|
|
356
359
|
TQueryFnData,
|
|
357
360
|
TError = DefaultError,
|
|
358
361
|
TData = TQueryFnData,
|
|
@@ -363,14 +366,14 @@ export class QueryClient extends QC {
|
|
|
363
366
|
FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>
|
|
364
367
|
>,
|
|
365
368
|
): Promise<TData> {
|
|
366
|
-
//
|
|
369
|
+
// oxlint-disable-next-line tanstack-query/no-restricted-syntax -- grandfathered deprecated wrapper implementation
|
|
367
370
|
return super.fetchQuery(cloneDeepUnref(options))
|
|
368
371
|
}
|
|
369
372
|
|
|
370
373
|
/**
|
|
371
374
|
* @deprecated Use queryClient.query(options) instead. You can swallow errors with `.catch(noop)`. This method will be removed in the next major version.
|
|
372
375
|
*/
|
|
373
|
-
prefetchQuery<
|
|
376
|
+
override prefetchQuery<
|
|
374
377
|
TQueryFnData = unknown,
|
|
375
378
|
TError = DefaultError,
|
|
376
379
|
TData = TQueryFnData,
|
|
@@ -378,7 +381,7 @@ export class QueryClient extends QC {
|
|
|
378
381
|
>(
|
|
379
382
|
options: FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>,
|
|
380
383
|
): Promise<void>
|
|
381
|
-
prefetchQuery<
|
|
384
|
+
override prefetchQuery<
|
|
382
385
|
TQueryFnData = unknown,
|
|
383
386
|
TError = DefaultError,
|
|
384
387
|
TData = TQueryFnData,
|
|
@@ -388,7 +391,7 @@ export class QueryClient extends QC {
|
|
|
388
391
|
FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>
|
|
389
392
|
>,
|
|
390
393
|
): Promise<void>
|
|
391
|
-
prefetchQuery<
|
|
394
|
+
override prefetchQuery<
|
|
392
395
|
TQueryFnData = unknown,
|
|
393
396
|
TError = DefaultError,
|
|
394
397
|
TData = TQueryFnData,
|
|
@@ -398,13 +401,13 @@ export class QueryClient extends QC {
|
|
|
398
401
|
FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>
|
|
399
402
|
>,
|
|
400
403
|
): Promise<void> {
|
|
401
|
-
//
|
|
404
|
+
// oxlint-disable-next-line tanstack-query/no-restricted-syntax -- grandfathered deprecated wrapper implementation
|
|
402
405
|
return super.prefetchQuery(cloneDeepUnref(options))
|
|
403
406
|
}
|
|
404
407
|
|
|
405
408
|
// These one-shot imperative methods do not resolve top-level option getters.
|
|
406
409
|
// Resolve getters explicitly before calling, e.g. queryClient.infiniteQuery(options()).
|
|
407
|
-
infiniteQuery<
|
|
410
|
+
override infiniteQuery<
|
|
408
411
|
TQueryFnData = unknown,
|
|
409
412
|
TError = DefaultError,
|
|
410
413
|
TData = InfiniteData<TQueryFnData>,
|
|
@@ -423,7 +426,7 @@ export class QueryClient extends QC {
|
|
|
423
426
|
? InfiniteData<TQueryFnData, TPageParam>
|
|
424
427
|
: TData
|
|
425
428
|
>
|
|
426
|
-
infiniteQuery<
|
|
429
|
+
override infiniteQuery<
|
|
427
430
|
TQueryFnData = unknown,
|
|
428
431
|
TError = DefaultError,
|
|
429
432
|
TData = InfiniteData<TQueryFnData>,
|
|
@@ -444,7 +447,7 @@ export class QueryClient extends QC {
|
|
|
444
447
|
? InfiniteData<TQueryFnData, TPageParam>
|
|
445
448
|
: TData
|
|
446
449
|
>
|
|
447
|
-
infiniteQuery<
|
|
450
|
+
override infiniteQuery<
|
|
448
451
|
TQueryFnData = unknown,
|
|
449
452
|
TError = DefaultError,
|
|
450
453
|
TData = InfiniteData<TQueryFnData>,
|
|
@@ -471,7 +474,7 @@ export class QueryClient extends QC {
|
|
|
471
474
|
/**
|
|
472
475
|
* @deprecated Use queryClient.infiniteQuery(options) instead. This method will be removed in the next major version.
|
|
473
476
|
*/
|
|
474
|
-
fetchInfiniteQuery<
|
|
477
|
+
override fetchInfiniteQuery<
|
|
475
478
|
TQueryFnData = unknown,
|
|
476
479
|
TError = DefaultError,
|
|
477
480
|
TData = TQueryFnData,
|
|
@@ -486,7 +489,7 @@ export class QueryClient extends QC {
|
|
|
486
489
|
TPageParam
|
|
487
490
|
>,
|
|
488
491
|
): Promise<InfiniteData<TData, TPageParam>>
|
|
489
|
-
fetchInfiniteQuery<
|
|
492
|
+
override fetchInfiniteQuery<
|
|
490
493
|
TQueryFnData,
|
|
491
494
|
TError = DefaultError,
|
|
492
495
|
TData = TQueryFnData,
|
|
@@ -503,7 +506,7 @@ export class QueryClient extends QC {
|
|
|
503
506
|
>
|
|
504
507
|
>,
|
|
505
508
|
): Promise<InfiniteData<TData, TPageParam>>
|
|
506
|
-
fetchInfiniteQuery<
|
|
509
|
+
override fetchInfiniteQuery<
|
|
507
510
|
TQueryFnData,
|
|
508
511
|
TError = DefaultError,
|
|
509
512
|
TData = TQueryFnData,
|
|
@@ -520,14 +523,14 @@ export class QueryClient extends QC {
|
|
|
520
523
|
>
|
|
521
524
|
>,
|
|
522
525
|
): Promise<InfiniteData<TData, TPageParam>> {
|
|
523
|
-
//
|
|
526
|
+
// oxlint-disable-next-line tanstack-query/no-restricted-syntax -- grandfathered deprecated wrapper implementation
|
|
524
527
|
return super.fetchInfiniteQuery(cloneDeepUnref(options))
|
|
525
528
|
}
|
|
526
529
|
|
|
527
530
|
/**
|
|
528
531
|
* @deprecated use void queryClient.infiniteQuery(options) instead. You can swallow errors with `.catch(noop)`. This method will be removed in the next major version.
|
|
529
532
|
*/
|
|
530
|
-
prefetchInfiniteQuery<
|
|
533
|
+
override prefetchInfiniteQuery<
|
|
531
534
|
TQueryFnData,
|
|
532
535
|
TError = DefaultError,
|
|
533
536
|
TData = TQueryFnData,
|
|
@@ -542,7 +545,7 @@ export class QueryClient extends QC {
|
|
|
542
545
|
TPageParam
|
|
543
546
|
>,
|
|
544
547
|
): Promise<void>
|
|
545
|
-
prefetchInfiniteQuery<
|
|
548
|
+
override prefetchInfiniteQuery<
|
|
546
549
|
TQueryFnData,
|
|
547
550
|
TError = DefaultError,
|
|
548
551
|
TData = TQueryFnData,
|
|
@@ -559,7 +562,7 @@ export class QueryClient extends QC {
|
|
|
559
562
|
>
|
|
560
563
|
>,
|
|
561
564
|
): Promise<void>
|
|
562
|
-
prefetchInfiniteQuery<
|
|
565
|
+
override prefetchInfiniteQuery<
|
|
563
566
|
TQueryFnData,
|
|
564
567
|
TError = DefaultError,
|
|
565
568
|
TData = TQueryFnData,
|
|
@@ -576,15 +579,15 @@ export class QueryClient extends QC {
|
|
|
576
579
|
>
|
|
577
580
|
>,
|
|
578
581
|
): Promise<void> {
|
|
579
|
-
//
|
|
582
|
+
// oxlint-disable-next-line tanstack-query/no-restricted-syntax -- grandfathered deprecated wrapper implementation
|
|
580
583
|
return super.prefetchInfiniteQuery(cloneDeepUnref(options))
|
|
581
584
|
}
|
|
582
585
|
|
|
583
|
-
setDefaultOptions(options: MaybeRefDeep<DefaultOptions>): void {
|
|
586
|
+
override setDefaultOptions(options: MaybeRefDeep<DefaultOptions>): void {
|
|
584
587
|
super.setDefaultOptions(cloneDeepUnref(options))
|
|
585
588
|
}
|
|
586
589
|
|
|
587
|
-
setQueryDefaults<
|
|
590
|
+
override setQueryDefaults<
|
|
588
591
|
TQueryFnData = unknown,
|
|
589
592
|
TError = DefaultError,
|
|
590
593
|
TData = TQueryFnData,
|
|
@@ -598,13 +601,13 @@ export class QueryClient extends QC {
|
|
|
598
601
|
super.setQueryDefaults(cloneDeepUnref(queryKey), cloneDeepUnref(options))
|
|
599
602
|
}
|
|
600
603
|
|
|
601
|
-
getQueryDefaults(
|
|
604
|
+
override getQueryDefaults(
|
|
602
605
|
queryKey: MaybeRefDeep<QueryKey>,
|
|
603
606
|
): OmitKeyof<QueryObserverOptions<any, any, any, any, any>, 'queryKey'> {
|
|
604
607
|
return super.getQueryDefaults(cloneDeepUnref(queryKey))
|
|
605
608
|
}
|
|
606
609
|
|
|
607
|
-
setMutationDefaults<
|
|
610
|
+
override setMutationDefaults<
|
|
608
611
|
TData = unknown,
|
|
609
612
|
TError = DefaultError,
|
|
610
613
|
TVariables = void,
|
|
@@ -621,7 +624,7 @@ export class QueryClient extends QC {
|
|
|
621
624
|
)
|
|
622
625
|
}
|
|
623
626
|
|
|
624
|
-
getMutationDefaults(
|
|
627
|
+
override getMutationDefaults(
|
|
625
628
|
mutationKey: MaybeRefDeep<MutationKey>,
|
|
626
629
|
): MutationObserverOptions<any, any, any, any> {
|
|
627
630
|
return super.getMutationDefaults(cloneDeepUnref(mutationKey))
|
package/src/queryOptions.ts
CHANGED
|
@@ -19,7 +19,6 @@ import type {
|
|
|
19
19
|
* The plain, unwrapped options that `queryOptions` hands back, and what `useQuery`, `useQueries`, and the
|
|
20
20
|
* `queryClient` methods see once `ref`s have been resolved. To pass options in, use
|
|
21
21
|
* {@link UseQueryOptions}, which accepts the same options as `ref`s and `computed`s too.
|
|
22
|
-
*
|
|
23
22
|
* @template TQueryFnData - The type your `queryFn` resolves to.
|
|
24
23
|
* @template TError - The type of errors your `queryFn` may throw.
|
|
25
24
|
* @template TData - The type `data` ends up as after `select` runs.
|
|
@@ -43,13 +42,14 @@ export type QueryOptions<
|
|
|
43
42
|
TQueryKey
|
|
44
43
|
>
|
|
45
44
|
]: Property extends 'enabled'
|
|
46
|
-
?
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
?
|
|
46
|
+
| MaybeRefOrGetter<boolean | undefined>
|
|
47
|
+
| (() => QueryBooleanOption<
|
|
48
|
+
TQueryFnData,
|
|
49
|
+
TError,
|
|
50
|
+
TQueryData,
|
|
51
|
+
DeepUnwrapRef<TQueryKey>
|
|
52
|
+
>)
|
|
53
53
|
: Property extends 'queryKey'
|
|
54
54
|
? MaybeRefOrGetter<TQueryKey>
|
|
55
55
|
: QueryObserverOptions<
|
|
@@ -81,7 +81,6 @@ type SkipTokenForUseQuery = symbol
|
|
|
81
81
|
* to `queryOptions`/`useQuery` already has a stable reference across reactive updates. An inline `select`
|
|
82
82
|
* created inside a whole-options getter is recreated — and so can change reference — every time that getter
|
|
83
83
|
* re-evaluates.
|
|
84
|
-
*
|
|
85
84
|
* @template TQueryFnData - The type your `queryFn` resolves to.
|
|
86
85
|
* @template TError - The type of errors your `queryFn` may throw.
|
|
87
86
|
* @template TData - The type `data` ends up as after `select` runs.
|
|
@@ -159,13 +158,13 @@ type WithDefinedInitialData<TQueryFnData> = {
|
|
|
159
158
|
* cache. Unlike `queryKey`/`enabled`, this is not reactive — it isn't re-evaluated on `ref` changes.
|
|
160
159
|
*/
|
|
161
160
|
initialData:
|
|
162
|
-
|
|
161
|
+
| NonUndefinedGuard<TQueryFnData>
|
|
162
|
+
| (() => NonUndefinedGuard<TQueryFnData>)
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
/**
|
|
166
166
|
* The options accepted by the `queryOptions` overload selected when no `initialData` is set — `data` may be
|
|
167
167
|
* `undefined` while the query is `pending`.
|
|
168
|
-
*
|
|
169
168
|
* @template TQueryFnData - The type your `queryFn` resolves to.
|
|
170
169
|
* @template TError - The type of errors your `queryFn` may throw.
|
|
171
170
|
* @template TData - The type `data` ends up as after `select` runs.
|
|
@@ -182,7 +181,6 @@ export type UndefinedInitialQueryOptions<
|
|
|
182
181
|
/**
|
|
183
182
|
* The options accepted by the `queryOptions` overload selected when `initialData` is set — `data` is never
|
|
184
183
|
* `undefined` (unless a `select` changes `TData` to include `undefined`).
|
|
185
|
-
*
|
|
186
184
|
* @template TQueryFnData - The type your `queryFn` resolves to.
|
|
187
185
|
* @template TError - The type of errors your `queryFn` may throw.
|
|
188
186
|
* @template TData - The type `data` ends up as after `select` runs.
|
|
@@ -196,6 +194,10 @@ export type DefinedInitialQueryOptions<
|
|
|
196
194
|
> = UseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey> &
|
|
197
195
|
WithDefinedInitialData<TQueryFnData>
|
|
198
196
|
|
|
197
|
+
/**
|
|
198
|
+
* The options returned by the `queryOptions` overload selected when `initialData` is omitted or may be
|
|
199
|
+
* `undefined`, with the `queryKey` tagged with the query's data and error types.
|
|
200
|
+
*/
|
|
199
201
|
export type UndefinedInitialQueryOptionsWithDataTag<
|
|
200
202
|
TQueryFnData = unknown,
|
|
201
203
|
TError = DefaultError,
|
|
@@ -205,6 +207,10 @@ export type UndefinedInitialQueryOptionsWithDataTag<
|
|
|
205
207
|
WithUndefinedInitialData<TQueryFnData> &
|
|
206
208
|
QueryKeyWithDataTag<TQueryKey, TQueryFnData, TError>
|
|
207
209
|
|
|
210
|
+
/**
|
|
211
|
+
* The options returned by the `queryOptions` overload selected when `initialData` is set, with the
|
|
212
|
+
* `queryKey` tagged with the query's data and error types.
|
|
213
|
+
*/
|
|
208
214
|
export type DefinedInitialQueryOptionsWithDataTag<
|
|
209
215
|
TQueryFnData = unknown,
|
|
210
216
|
TError = DefaultError,
|
|
@@ -221,12 +227,10 @@ export type DefinedInitialQueryOptionsWithDataTag<
|
|
|
221
227
|
*
|
|
222
228
|
* This overload is selected when `initialData` is set, so the resulting `data` is never `undefined` (unless
|
|
223
229
|
* a `select` changes `TData` to include `undefined`).
|
|
224
|
-
*
|
|
225
|
-
* @see {@link useQuery} to run a query with these options.
|
|
226
230
|
* @param options - The {@link DefinedInitialQueryOptions} to use — everything you can pass to `useQuery`, with
|
|
227
231
|
* `initialData` set.
|
|
228
232
|
* @returns The same options object, typed so that `queryKey` carries the inferred data type.
|
|
229
|
-
*
|
|
233
|
+
* @see {@link useQuery} to run a query with these options.
|
|
230
234
|
* @example
|
|
231
235
|
* ```vue
|
|
232
236
|
* <script setup lang="ts">
|
|
@@ -257,12 +261,10 @@ export function queryOptions<
|
|
|
257
261
|
* Same as the plain-object overload, but for options that close over reactive state (`ref`s read inside the
|
|
258
262
|
* function body). Wrap them in a getter so `queryClient` methods like `invalidateQueries`/`fetchQuery` always
|
|
259
263
|
* read the current values instead of the ones captured when the options were created.
|
|
260
|
-
*
|
|
261
|
-
* @see {@link useQuery} to run a query with these options.
|
|
262
264
|
* @param options - A function returning the {@link DefinedInitialQueryOptions} to use, re-evaluated on demand.
|
|
263
265
|
* @returns A function that returns the same options object, typed so that `queryKey` carries the inferred data
|
|
264
266
|
* type.
|
|
265
|
-
*
|
|
267
|
+
* @see {@link useQuery} to run a query with these options.
|
|
266
268
|
* @example
|
|
267
269
|
* ```vue
|
|
268
270
|
* <script setup lang="ts">
|
|
@@ -304,11 +306,9 @@ export function queryOptions<
|
|
|
304
306
|
* You can generally pass everything to `queryOptions` that you can also pass to `useQuery`. These options can
|
|
305
307
|
* be shared across hooks and imperative APIs such as `queryClient.query`. `options.queryKey` is required and
|
|
306
308
|
* is the query key to generate options for.
|
|
307
|
-
*
|
|
308
|
-
* @see {@link useQuery} to run a query with these options.
|
|
309
309
|
* @param options - The {@link UndefinedInitialQueryOptions} to use — everything you can pass to `useQuery`.
|
|
310
310
|
* @returns The same options object, typed so that `queryKey` carries the inferred data type.
|
|
311
|
-
*
|
|
311
|
+
* @see {@link useQuery} to run a query with these options.
|
|
312
312
|
* @example
|
|
313
313
|
* A parameterized factory, so the same options object can be reused per `id`:
|
|
314
314
|
* ```vue
|
|
@@ -345,13 +345,11 @@ export function queryOptions<
|
|
|
345
345
|
* function body). Wrap them in a getter so the `queryKey` — and anything else derived from a `ref` — reacts
|
|
346
346
|
* to changes, and so `queryClient` methods like `invalidateQueries`/`fetchQuery` always read the current
|
|
347
347
|
* values instead of the ones captured when the options were created.
|
|
348
|
-
*
|
|
349
|
-
* @see {@link useQuery} to run a query with these options.
|
|
350
348
|
* @param options - A function returning the {@link UndefinedInitialQueryOptions} to use, re-evaluated on
|
|
351
349
|
* demand.
|
|
352
350
|
* @returns A function that returns the same options object, typed so that `queryKey` carries the inferred
|
|
353
351
|
* data type.
|
|
354
|
-
*
|
|
352
|
+
* @see {@link useQuery} to run a query with these options.
|
|
355
353
|
* @example
|
|
356
354
|
* ```vue
|
|
357
355
|
* <script setup lang="ts">
|
|
@@ -371,7 +369,6 @@ export function queryOptions<
|
|
|
371
369
|
* queryClient.invalidateQueries(postOptions())
|
|
372
370
|
* </script>
|
|
373
371
|
* ```
|
|
374
|
-
*
|
|
375
372
|
* @example
|
|
376
373
|
* A parameterized factory that disables the query, type safe, until `postId` is set. The whole-options getter
|
|
377
374
|
* re-evaluates `queryFn` on every change to `postId`. `queryFn` can also be a `computed`, but never a bare
|
package/src/types.ts
CHANGED
|
@@ -53,10 +53,16 @@ export type MaybeRefDeep<T> = MaybeRef<
|
|
|
53
53
|
: T
|
|
54
54
|
>
|
|
55
55
|
|
|
56
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Rejects `unknown`, collapsing it to `never` — used to keep generic inference from silently widening.
|
|
58
|
+
* @internal
|
|
59
|
+
*/
|
|
57
60
|
export type NoUnknown<T> = Equal<unknown, T> extends true ? never : T
|
|
58
61
|
|
|
59
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* Type-level equality check between `TTargetA` and `TTargetB`.
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
60
66
|
export type Equal<TTargetA, TTargetB> =
|
|
61
67
|
(<T>() => T extends TTargetA ? 1 : 2) extends <T>() => T extends TTargetB
|
|
62
68
|
? 1
|
|
@@ -75,6 +81,9 @@ export type DeepUnwrapRef<T> = T extends UnwrapLeaf
|
|
|
75
81
|
}
|
|
76
82
|
: UnwrapRef<T>
|
|
77
83
|
|
|
84
|
+
/**
|
|
85
|
+
* The `vue-query`-specific `shallow` option, accepted by query and mutation options.
|
|
86
|
+
*/
|
|
78
87
|
export type ShallowOption = {
|
|
79
88
|
/**
|
|
80
89
|
* Return data in a shallow ref object (it is `false` by default). It can be set to `true` to return data in a shallow ref object, which can improve performance if your data does not need to be deeply reactive.
|
|
@@ -82,6 +91,10 @@ export type ShallowOption = {
|
|
|
82
91
|
shallow?: boolean
|
|
83
92
|
}
|
|
84
93
|
|
|
94
|
+
/**
|
|
95
|
+
* The options of a mutation. Same as {@link MutationObserverOptions} from `@tanstack/query-core`, minus the
|
|
96
|
+
* internal `_defaulted` flag, plus the `shallow` option.
|
|
97
|
+
*/
|
|
85
98
|
export type MutationOptions<
|
|
86
99
|
TData = unknown,
|
|
87
100
|
TError = DefaultError,
|
|
@@ -93,17 +106,49 @@ export type MutationOptions<
|
|
|
93
106
|
> &
|
|
94
107
|
ShallowOption
|
|
95
108
|
|
|
109
|
+
/**
|
|
110
|
+
* The default options of a `QueryClient`, applied to every query (`queries`), mutation
|
|
111
|
+
* (`mutations`), `hydrate`, and `dehydrate` call unless overridden. Query and mutation defaults also
|
|
112
|
+
* accept the `shallow` option.
|
|
113
|
+
*/
|
|
96
114
|
export interface DefaultOptions<TError = DefaultError> {
|
|
115
|
+
/**
|
|
116
|
+
* Default options applied to every query, unless overridden per-query. Also accepts the
|
|
117
|
+
* `shallow` option.
|
|
118
|
+
*/
|
|
97
119
|
queries?: OmitKeyof<QueryObserverOptions<unknown, TError>, 'queryKey'> &
|
|
98
120
|
ShallowOption
|
|
121
|
+
/**
|
|
122
|
+
* Default options applied to every mutation, unless overridden per-mutation. Also accepts the
|
|
123
|
+
* `shallow` option.
|
|
124
|
+
*/
|
|
99
125
|
mutations?: MutationObserverOptions<unknown, TError, unknown, unknown> &
|
|
100
126
|
ShallowOption
|
|
127
|
+
/**
|
|
128
|
+
* Default options used when hydrating queries and mutations; see {@link HydrateOptions}.
|
|
129
|
+
*/
|
|
101
130
|
hydrate?: HydrateOptions['defaultOptions']
|
|
131
|
+
/**
|
|
132
|
+
* Default options used when dehydrating the client's caches; see {@link DehydrateOptions}.
|
|
133
|
+
*/
|
|
102
134
|
dehydrate?: DehydrateOptions
|
|
103
135
|
}
|
|
104
136
|
|
|
137
|
+
/**
|
|
138
|
+
* The options of `new QueryClient()`: the `queryCache` and `mutationCache` to use, and the
|
|
139
|
+
* `defaultOptions` for its queries and mutations.
|
|
140
|
+
*/
|
|
105
141
|
export interface QueryClientConfig {
|
|
142
|
+
/**
|
|
143
|
+
* The `QueryCache` to use. A new one is created if omitted.
|
|
144
|
+
*/
|
|
106
145
|
queryCache?: QueryCache
|
|
146
|
+
/**
|
|
147
|
+
* The `MutationCache` to use. A new one is created if omitted.
|
|
148
|
+
*/
|
|
107
149
|
mutationCache?: MutationCache
|
|
150
|
+
/**
|
|
151
|
+
* The default options of the queries and mutations of this `QueryClient`.
|
|
152
|
+
*/
|
|
108
153
|
defaultOptions?: DefaultOptions
|
|
109
154
|
}
|
package/src/useBaseQuery.ts
CHANGED
|
@@ -24,13 +24,19 @@ import type { UseQueryOptions } from './queryOptions'
|
|
|
24
24
|
import type { UseInfiniteQueryOptions } from './useInfiniteQuery'
|
|
25
25
|
import type { MaybeRefOrGetter } from './types'
|
|
26
26
|
|
|
27
|
+
/**
|
|
28
|
+
* The result of the query composables: every property of the observer result wrapped in a `Ref`, except
|
|
29
|
+
* the `refetch`, `fetchNextPage`, and `fetchPreviousPage` functions, plus `suspense`.
|
|
30
|
+
*/
|
|
27
31
|
export type UseBaseQueryReturnType<
|
|
28
32
|
TData,
|
|
29
33
|
TError,
|
|
30
34
|
TResult = QueryObserverResult<TData, TError>,
|
|
31
35
|
> = {
|
|
32
36
|
[K in keyof TResult]: K extends
|
|
33
|
-
|
|
37
|
+
| 'fetchNextPage'
|
|
38
|
+
| 'fetchPreviousPage'
|
|
39
|
+
| 'refetch'
|
|
34
40
|
? TResult[K]
|
|
35
41
|
: Ref<Readonly<TResult>[K]>
|
|
36
42
|
} & {
|
|
@@ -58,11 +64,11 @@ type UseQueryOptionsGeneric<
|
|
|
58
64
|
|
|
59
65
|
/**
|
|
60
66
|
* Base implementation shared by `useQuery` and `useInfiniteQuery`.
|
|
61
|
-
*
|
|
62
67
|
* @param Observer - The observer class from query-core (`QueryObserver` or `InfiniteQueryObserver`).
|
|
63
68
|
* @param options - A `ref`, plain value, or reactive getter resolving to the query options.
|
|
64
69
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`
|
|
65
70
|
* will be used.
|
|
71
|
+
* @returns The query result as `ref`s, plus the `suspense` function.
|
|
66
72
|
*/
|
|
67
73
|
export function useBaseQuery<
|
|
68
74
|
TQueryFnData,
|