@tanstack/react-query 5.104.5 → 5.105.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/legacy/HydrationBoundary.cjs +2 -3
- package/build/legacy/HydrationBoundary.cjs.map +1 -1
- package/build/legacy/HydrationBoundary.d.cts +0 -2
- package/build/legacy/HydrationBoundary.d.cts.map +1 -1
- package/build/legacy/HydrationBoundary.d.ts +0 -2
- package/build/legacy/HydrationBoundary.d.ts.map +1 -1
- package/build/legacy/HydrationBoundary.js +1 -2
- package/build/legacy/HydrationBoundary.js.map +1 -1
- package/build/legacy/IsRestoringProvider.cjs +2 -3
- package/build/legacy/IsRestoringProvider.d.cts +0 -2
- package/build/legacy/IsRestoringProvider.d.cts.map +1 -1
- package/build/legacy/IsRestoringProvider.d.ts +0 -2
- package/build/legacy/IsRestoringProvider.d.ts.map +1 -1
- package/build/legacy/IsRestoringProvider.js +1 -2
- package/build/legacy/QueryClientProvider.cjs +2 -3
- package/build/legacy/QueryClientProvider.d.cts +0 -2
- package/build/legacy/QueryClientProvider.d.cts.map +1 -1
- package/build/legacy/QueryClientProvider.d.ts +0 -2
- package/build/legacy/QueryClientProvider.d.ts.map +1 -1
- package/build/legacy/QueryClientProvider.js +1 -2
- package/build/legacy/QueryErrorResetBoundary.cjs +2 -3
- package/build/legacy/QueryErrorResetBoundary.d.cts +1 -3
- package/build/legacy/QueryErrorResetBoundary.d.cts.map +1 -1
- package/build/legacy/QueryErrorResetBoundary.d.ts +1 -3
- package/build/legacy/QueryErrorResetBoundary.d.ts.map +1 -1
- package/build/legacy/QueryErrorResetBoundary.js +1 -2
- package/build/legacy/errorBoundaryUtils.cjs +2 -3
- package/build/legacy/errorBoundaryUtils.d.cts +0 -2
- package/build/legacy/errorBoundaryUtils.d.cts.map +1 -1
- package/build/legacy/errorBoundaryUtils.d.ts +0 -2
- package/build/legacy/errorBoundaryUtils.d.ts.map +1 -1
- package/build/legacy/errorBoundaryUtils.js +1 -2
- package/build/legacy/index.cjs +1 -2
- package/build/legacy/index.js +1 -2
- package/build/legacy/infiniteQueryOptions.cjs +1 -2
- package/build/legacy/infiniteQueryOptions.cjs.map +1 -1
- package/build/legacy/infiniteQueryOptions.d.cts +16 -16
- package/build/legacy/infiniteQueryOptions.d.cts.map +1 -1
- package/build/legacy/infiniteQueryOptions.d.ts +16 -16
- package/build/legacy/infiniteQueryOptions.d.ts.map +1 -1
- package/build/legacy/infiniteQueryOptions.js +1 -2
- package/build/legacy/infiniteQueryOptions.js.map +1 -1
- package/build/legacy/mutationOptions.cjs +1 -2
- package/build/legacy/mutationOptions.d.cts +0 -2
- package/build/legacy/mutationOptions.d.cts.map +1 -1
- package/build/legacy/mutationOptions.d.ts +0 -2
- package/build/legacy/mutationOptions.d.ts.map +1 -1
- package/build/legacy/mutationOptions.js +1 -2
- package/build/legacy/queryOptions.cjs +1 -2
- package/build/legacy/queryOptions.cjs.map +1 -1
- package/build/legacy/queryOptions.d.cts +16 -15
- package/build/legacy/queryOptions.d.cts.map +1 -1
- package/build/legacy/queryOptions.d.ts +16 -15
- package/build/legacy/queryOptions.d.ts.map +1 -1
- package/build/legacy/queryOptions.js +1 -2
- package/build/legacy/queryOptions.js.map +1 -1
- package/build/legacy/{rolldown-runtime-VH7oDXx4.cjs → rolldown-runtime-CmQyd0Gu.cjs} +1 -2
- package/build/legacy/suspense.cjs +1 -2
- package/build/legacy/suspense.d.cts +0 -2
- package/build/legacy/suspense.d.cts.map +1 -1
- package/build/legacy/suspense.d.ts +0 -2
- package/build/legacy/suspense.d.ts.map +1 -1
- package/build/legacy/suspense.js +1 -2
- package/build/legacy/types.cjs +1 -2
- package/build/legacy/types.d.cts +0 -2
- package/build/legacy/types.d.cts.map +1 -1
- package/build/legacy/types.d.ts +0 -2
- package/build/legacy/types.d.ts.map +1 -1
- package/build/legacy/types.js +1 -2
- package/build/legacy/useBaseQuery.cjs +2 -3
- package/build/legacy/useBaseQuery.d.cts +0 -2
- package/build/legacy/useBaseQuery.d.cts.map +1 -1
- package/build/legacy/useBaseQuery.d.ts +0 -2
- package/build/legacy/useBaseQuery.d.ts.map +1 -1
- package/build/legacy/useBaseQuery.js +1 -2
- package/build/legacy/useInfiniteQuery.cjs +1 -2
- package/build/legacy/useInfiniteQuery.cjs.map +1 -1
- package/build/legacy/useInfiniteQuery.d.cts +2 -4
- package/build/legacy/useInfiniteQuery.d.cts.map +1 -1
- package/build/legacy/useInfiniteQuery.d.ts +2 -4
- package/build/legacy/useInfiniteQuery.d.ts.map +1 -1
- package/build/legacy/useInfiniteQuery.js +1 -2
- package/build/legacy/useInfiniteQuery.js.map +1 -1
- package/build/legacy/useIsFetching.cjs +2 -3
- package/build/legacy/useIsFetching.cjs.map +1 -1
- package/build/legacy/useIsFetching.d.cts +1 -3
- package/build/legacy/useIsFetching.d.cts.map +1 -1
- package/build/legacy/useIsFetching.d.ts +1 -3
- package/build/legacy/useIsFetching.d.ts.map +1 -1
- package/build/legacy/useIsFetching.js +1 -2
- package/build/legacy/useIsFetching.js.map +1 -1
- package/build/legacy/useMutation.cjs +2 -3
- package/build/legacy/useMutation.d.cts +0 -2
- package/build/legacy/useMutation.d.cts.map +1 -1
- package/build/legacy/useMutation.d.ts +0 -2
- package/build/legacy/useMutation.d.ts.map +1 -1
- package/build/legacy/useMutation.js +1 -2
- package/build/legacy/useMutationState.cjs +2 -3
- package/build/legacy/useMutationState.d.cts +0 -2
- package/build/legacy/useMutationState.d.cts.map +1 -1
- package/build/legacy/useMutationState.d.ts +0 -2
- package/build/legacy/useMutationState.d.ts.map +1 -1
- package/build/legacy/useMutationState.js +1 -2
- package/build/legacy/usePrefetchInfiniteQuery.cjs +1 -2
- package/build/legacy/usePrefetchInfiniteQuery.d.cts +0 -2
- package/build/legacy/usePrefetchInfiniteQuery.d.cts.map +1 -1
- package/build/legacy/usePrefetchInfiniteQuery.d.ts +0 -2
- package/build/legacy/usePrefetchInfiniteQuery.d.ts.map +1 -1
- package/build/legacy/usePrefetchInfiniteQuery.js +1 -2
- package/build/legacy/usePrefetchQuery.cjs +1 -2
- package/build/legacy/usePrefetchQuery.d.cts +0 -2
- package/build/legacy/usePrefetchQuery.d.cts.map +1 -1
- package/build/legacy/usePrefetchQuery.d.ts +0 -2
- package/build/legacy/usePrefetchQuery.d.ts.map +1 -1
- package/build/legacy/usePrefetchQuery.js +1 -2
- package/build/legacy/useQueries.cjs +2 -3
- package/build/legacy/useQueries.d.cts +0 -2
- package/build/legacy/useQueries.d.cts.map +1 -1
- package/build/legacy/useQueries.d.ts +0 -2
- package/build/legacy/useQueries.d.ts.map +1 -1
- package/build/legacy/useQueries.js +1 -2
- package/build/legacy/useQuery.cjs +1 -2
- package/build/legacy/useQuery.cjs.map +1 -1
- package/build/legacy/useQuery.d.cts +5 -7
- package/build/legacy/useQuery.d.cts.map +1 -1
- package/build/legacy/useQuery.d.ts +5 -7
- package/build/legacy/useQuery.d.ts.map +1 -1
- package/build/legacy/useQuery.js +1 -2
- package/build/legacy/useQuery.js.map +1 -1
- package/build/legacy/useSuspenseInfiniteQuery.cjs +1 -2
- package/build/legacy/useSuspenseInfiniteQuery.d.cts +0 -2
- package/build/legacy/useSuspenseInfiniteQuery.d.cts.map +1 -1
- package/build/legacy/useSuspenseInfiniteQuery.d.ts +0 -2
- package/build/legacy/useSuspenseInfiniteQuery.d.ts.map +1 -1
- package/build/legacy/useSuspenseInfiniteQuery.js +1 -2
- package/build/legacy/useSuspenseQueries.cjs +1 -2
- package/build/legacy/useSuspenseQueries.d.cts +0 -2
- package/build/legacy/useSuspenseQueries.d.cts.map +1 -1
- package/build/legacy/useSuspenseQueries.d.ts +0 -2
- package/build/legacy/useSuspenseQueries.d.ts.map +1 -1
- package/build/legacy/useSuspenseQueries.js +1 -2
- package/build/legacy/useSuspenseQuery.cjs +1 -2
- package/build/legacy/useSuspenseQuery.d.cts +0 -2
- package/build/legacy/useSuspenseQuery.d.cts.map +1 -1
- package/build/legacy/useSuspenseQuery.d.ts +0 -2
- package/build/legacy/useSuspenseQuery.d.ts.map +1 -1
- package/build/legacy/useSuspenseQuery.js +1 -2
- package/build/modern/HydrationBoundary.cjs +2 -3
- package/build/modern/HydrationBoundary.cjs.map +1 -1
- package/build/modern/HydrationBoundary.d.cts +0 -2
- package/build/modern/HydrationBoundary.d.cts.map +1 -1
- package/build/modern/HydrationBoundary.d.ts +0 -2
- package/build/modern/HydrationBoundary.d.ts.map +1 -1
- package/build/modern/HydrationBoundary.js +1 -2
- package/build/modern/HydrationBoundary.js.map +1 -1
- package/build/modern/IsRestoringProvider.cjs +2 -3
- package/build/modern/IsRestoringProvider.d.cts +0 -2
- package/build/modern/IsRestoringProvider.d.cts.map +1 -1
- package/build/modern/IsRestoringProvider.d.ts +0 -2
- package/build/modern/IsRestoringProvider.d.ts.map +1 -1
- package/build/modern/IsRestoringProvider.js +1 -2
- package/build/modern/QueryClientProvider.cjs +2 -3
- package/build/modern/QueryClientProvider.d.cts +0 -2
- package/build/modern/QueryClientProvider.d.cts.map +1 -1
- package/build/modern/QueryClientProvider.d.ts +0 -2
- package/build/modern/QueryClientProvider.d.ts.map +1 -1
- package/build/modern/QueryClientProvider.js +1 -2
- package/build/modern/QueryErrorResetBoundary.cjs +2 -3
- package/build/modern/QueryErrorResetBoundary.d.cts +1 -3
- package/build/modern/QueryErrorResetBoundary.d.cts.map +1 -1
- package/build/modern/QueryErrorResetBoundary.d.ts +1 -3
- package/build/modern/QueryErrorResetBoundary.d.ts.map +1 -1
- package/build/modern/QueryErrorResetBoundary.js +1 -2
- package/build/modern/errorBoundaryUtils.cjs +2 -3
- package/build/modern/errorBoundaryUtils.d.cts +0 -2
- package/build/modern/errorBoundaryUtils.d.cts.map +1 -1
- package/build/modern/errorBoundaryUtils.d.ts +0 -2
- package/build/modern/errorBoundaryUtils.d.ts.map +1 -1
- package/build/modern/errorBoundaryUtils.js +1 -2
- package/build/modern/index.cjs +1 -2
- package/build/modern/index.js +1 -2
- package/build/modern/infiniteQueryOptions.cjs +1 -2
- package/build/modern/infiniteQueryOptions.cjs.map +1 -1
- package/build/modern/infiniteQueryOptions.d.cts +16 -16
- package/build/modern/infiniteQueryOptions.d.cts.map +1 -1
- package/build/modern/infiniteQueryOptions.d.ts +16 -16
- package/build/modern/infiniteQueryOptions.d.ts.map +1 -1
- package/build/modern/infiniteQueryOptions.js +1 -2
- package/build/modern/infiniteQueryOptions.js.map +1 -1
- package/build/modern/mutationOptions.cjs +1 -2
- package/build/modern/mutationOptions.d.cts +0 -2
- package/build/modern/mutationOptions.d.cts.map +1 -1
- package/build/modern/mutationOptions.d.ts +0 -2
- package/build/modern/mutationOptions.d.ts.map +1 -1
- package/build/modern/mutationOptions.js +1 -2
- package/build/modern/queryOptions.cjs +1 -2
- package/build/modern/queryOptions.cjs.map +1 -1
- package/build/modern/queryOptions.d.cts +16 -15
- package/build/modern/queryOptions.d.cts.map +1 -1
- package/build/modern/queryOptions.d.ts +16 -15
- package/build/modern/queryOptions.d.ts.map +1 -1
- package/build/modern/queryOptions.js +1 -2
- package/build/modern/queryOptions.js.map +1 -1
- package/build/modern/{rolldown-runtime-VH7oDXx4.cjs → rolldown-runtime-CmQyd0Gu.cjs} +1 -2
- package/build/modern/suspense.cjs +1 -2
- package/build/modern/suspense.d.cts +0 -2
- package/build/modern/suspense.d.cts.map +1 -1
- package/build/modern/suspense.d.ts +0 -2
- package/build/modern/suspense.d.ts.map +1 -1
- package/build/modern/suspense.js +1 -2
- package/build/modern/types.cjs +1 -2
- package/build/modern/types.d.cts +0 -2
- package/build/modern/types.d.cts.map +1 -1
- package/build/modern/types.d.ts +0 -2
- package/build/modern/types.d.ts.map +1 -1
- package/build/modern/types.js +1 -2
- package/build/modern/useBaseQuery.cjs +2 -3
- package/build/modern/useBaseQuery.d.cts +0 -2
- package/build/modern/useBaseQuery.d.cts.map +1 -1
- package/build/modern/useBaseQuery.d.ts +0 -2
- package/build/modern/useBaseQuery.d.ts.map +1 -1
- package/build/modern/useBaseQuery.js +1 -2
- package/build/modern/useInfiniteQuery.cjs +1 -2
- package/build/modern/useInfiniteQuery.cjs.map +1 -1
- package/build/modern/useInfiniteQuery.d.cts +2 -4
- package/build/modern/useInfiniteQuery.d.cts.map +1 -1
- package/build/modern/useInfiniteQuery.d.ts +2 -4
- package/build/modern/useInfiniteQuery.d.ts.map +1 -1
- package/build/modern/useInfiniteQuery.js +1 -2
- package/build/modern/useInfiniteQuery.js.map +1 -1
- package/build/modern/useIsFetching.cjs +2 -3
- package/build/modern/useIsFetching.cjs.map +1 -1
- package/build/modern/useIsFetching.d.cts +1 -3
- package/build/modern/useIsFetching.d.cts.map +1 -1
- package/build/modern/useIsFetching.d.ts +1 -3
- package/build/modern/useIsFetching.d.ts.map +1 -1
- package/build/modern/useIsFetching.js +1 -2
- package/build/modern/useIsFetching.js.map +1 -1
- package/build/modern/useMutation.cjs +2 -3
- package/build/modern/useMutation.d.cts +0 -2
- package/build/modern/useMutation.d.cts.map +1 -1
- package/build/modern/useMutation.d.ts +0 -2
- package/build/modern/useMutation.d.ts.map +1 -1
- package/build/modern/useMutation.js +1 -2
- package/build/modern/useMutationState.cjs +2 -3
- package/build/modern/useMutationState.d.cts +0 -2
- package/build/modern/useMutationState.d.cts.map +1 -1
- package/build/modern/useMutationState.d.ts +0 -2
- package/build/modern/useMutationState.d.ts.map +1 -1
- package/build/modern/useMutationState.js +1 -2
- package/build/modern/usePrefetchInfiniteQuery.cjs +1 -2
- package/build/modern/usePrefetchInfiniteQuery.d.cts +0 -2
- package/build/modern/usePrefetchInfiniteQuery.d.cts.map +1 -1
- package/build/modern/usePrefetchInfiniteQuery.d.ts +0 -2
- package/build/modern/usePrefetchInfiniteQuery.d.ts.map +1 -1
- package/build/modern/usePrefetchInfiniteQuery.js +1 -2
- package/build/modern/usePrefetchQuery.cjs +1 -2
- package/build/modern/usePrefetchQuery.d.cts +0 -2
- package/build/modern/usePrefetchQuery.d.cts.map +1 -1
- package/build/modern/usePrefetchQuery.d.ts +0 -2
- package/build/modern/usePrefetchQuery.d.ts.map +1 -1
- package/build/modern/usePrefetchQuery.js +1 -2
- package/build/modern/useQueries.cjs +2 -3
- package/build/modern/useQueries.d.cts +0 -2
- package/build/modern/useQueries.d.cts.map +1 -1
- package/build/modern/useQueries.d.ts +0 -2
- package/build/modern/useQueries.d.ts.map +1 -1
- package/build/modern/useQueries.js +1 -2
- package/build/modern/useQuery.cjs +1 -2
- package/build/modern/useQuery.cjs.map +1 -1
- package/build/modern/useQuery.d.cts +5 -7
- package/build/modern/useQuery.d.cts.map +1 -1
- package/build/modern/useQuery.d.ts +5 -7
- package/build/modern/useQuery.d.ts.map +1 -1
- package/build/modern/useQuery.js +1 -2
- package/build/modern/useQuery.js.map +1 -1
- package/build/modern/useSuspenseInfiniteQuery.cjs +1 -2
- package/build/modern/useSuspenseInfiniteQuery.d.cts +0 -2
- package/build/modern/useSuspenseInfiniteQuery.d.cts.map +1 -1
- package/build/modern/useSuspenseInfiniteQuery.d.ts +0 -2
- package/build/modern/useSuspenseInfiniteQuery.d.ts.map +1 -1
- package/build/modern/useSuspenseInfiniteQuery.js +1 -2
- package/build/modern/useSuspenseQueries.cjs +1 -2
- package/build/modern/useSuspenseQueries.d.cts +0 -2
- package/build/modern/useSuspenseQueries.d.cts.map +1 -1
- package/build/modern/useSuspenseQueries.d.ts +0 -2
- package/build/modern/useSuspenseQueries.d.ts.map +1 -1
- package/build/modern/useSuspenseQueries.js +1 -2
- package/build/modern/useSuspenseQuery.cjs +1 -2
- package/build/modern/useSuspenseQuery.d.cts +0 -2
- package/build/modern/useSuspenseQuery.d.cts.map +1 -1
- package/build/modern/useSuspenseQuery.d.ts +0 -2
- package/build/modern/useSuspenseQuery.d.ts.map +1 -1
- package/build/modern/useSuspenseQuery.js +1 -2
- package/package.json +8 -8
- package/src/HydrationBoundary.tsx +1 -1
- package/src/infiniteQueryOptions.ts +15 -14
- package/src/queryOptions.ts +16 -13
- package/src/useInfiniteQuery.ts +2 -2
- package/src/useIsFetching.ts +1 -1
- package/src/useQuery.ts +5 -5
|
@@ -11,8 +11,9 @@ import type {
|
|
|
11
11
|
import type { UseInfiniteQueryOptions } from './types'
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* The options accepted by the `infiniteQueryOptions` overload selected when
|
|
15
|
-
* may be `undefined` while the query is
|
|
14
|
+
* The options accepted by the `infiniteQueryOptions` overload selected when `initialData` is omitted, may be
|
|
15
|
+
* `undefined`, or is a function that may return `undefined` — `data` may be `undefined` while the query is
|
|
16
|
+
* `pending`.
|
|
16
17
|
* @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.
|
|
17
18
|
* @template TError - The type of errors your `queryFn` may throw.
|
|
18
19
|
* @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,
|
|
@@ -49,9 +50,9 @@ export type UndefinedInitialDataInfiniteOptions<
|
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
/**
|
|
52
|
-
* The options accepted by the `infiniteQueryOptions` overload selected when
|
|
53
|
-
* `
|
|
54
|
-
* `skipToken`.
|
|
53
|
+
* The options accepted by the `infiniteQueryOptions` overload selected when `queryFn` is not `skipToken` and
|
|
54
|
+
* `initialData` is omitted, may be `undefined`, or is a function that may return `undefined` — same as
|
|
55
|
+
* {@link UndefinedInitialDataInfiniteOptions}, but `queryFn` may not be `skipToken`.
|
|
55
56
|
* @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.
|
|
56
57
|
* @template TError - The type of errors your `queryFn` may throw.
|
|
57
58
|
* @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,
|
|
@@ -70,10 +71,11 @@ export type UnusedSkipTokenInfiniteOptions<
|
|
|
70
71
|
'queryFn'
|
|
71
72
|
> & {
|
|
72
73
|
/**
|
|
73
|
-
* `skipToken` is not allowed as a value here — this overload is selected when
|
|
74
|
-
* you don't intend to run the query yet,
|
|
75
|
-
*
|
|
76
|
-
*
|
|
74
|
+
* `skipToken` is not allowed as a value here — this overload is selected when `initialData` is omitted, may
|
|
75
|
+
* be `undefined`, or is a function that may return `undefined`. If you don't intend to run the query yet,
|
|
76
|
+
* set `enabled: false` — omitting `queryFn` alone still triggers a fetch that fails with "Missing queryFn"
|
|
77
|
+
* unless `enabled` is `false` or a default query function has been defined. A default query function only
|
|
78
|
+
* supplies `queryFn`; it doesn't defer the fetch on its own.
|
|
77
79
|
*/
|
|
78
80
|
queryFn?: Exclude<
|
|
79
81
|
UseInfiniteQueryOptions<
|
|
@@ -88,8 +90,8 @@ export type UnusedSkipTokenInfiniteOptions<
|
|
|
88
90
|
}
|
|
89
91
|
|
|
90
92
|
/**
|
|
91
|
-
* The options accepted by the `infiniteQueryOptions` overload selected when `initialData` is
|
|
92
|
-
* never `undefined` (unless a `select` changes `TData` to include `undefined`).
|
|
93
|
+
* The options accepted by the `infiniteQueryOptions` overload selected when `initialData` is known to be
|
|
94
|
+
* defined — `data` is never `undefined` (unless a `select` changes `TData` to include `undefined`).
|
|
93
95
|
* @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.
|
|
94
96
|
* @template TError - The type of errors your `queryFn` may throw.
|
|
95
97
|
* @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,
|
|
@@ -120,7 +122,6 @@ export type DefinedInitialDataInfiniteOptions<
|
|
|
120
122
|
initialData:
|
|
121
123
|
| NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>
|
|
122
124
|
| (() => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>)
|
|
123
|
-
| undefined
|
|
124
125
|
}
|
|
125
126
|
|
|
126
127
|
/**
|
|
@@ -128,8 +129,8 @@ export type DefinedInitialDataInfiniteOptions<
|
|
|
128
129
|
* These options can be shared across hooks and imperative APIs such as `queryClient.infiniteQuery`.
|
|
129
130
|
* `options.queryKey` is required and is the query key to generate options for.
|
|
130
131
|
*
|
|
131
|
-
* This overload is selected when `initialData` is
|
|
132
|
-
* @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`, with `initialData`
|
|
132
|
+
* This overload is selected when `initialData` is known to be defined.
|
|
133
|
+
* @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`, with `initialData` known to be defined.
|
|
133
134
|
* @returns The same options object, typed so that `queryKey` carries the inferred data type.
|
|
134
135
|
* @remarks See {@link useInfiniteQuery} for examples that fetch further pages, from a button click or
|
|
135
136
|
* automatically as the user scrolls.
|
package/src/queryOptions.ts
CHANGED
|
@@ -11,8 +11,9 @@ import type {
|
|
|
11
11
|
import type { UseQueryOptions } from './types'
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* The options accepted by the `queryOptions` overload selected when
|
|
15
|
-
* `undefined` while the query is
|
|
14
|
+
* The options accepted by the `queryOptions` overload selected when `initialData` is omitted, may be
|
|
15
|
+
* `undefined`, or is a function that may return `undefined` — `data` may be `undefined` while the query is
|
|
16
|
+
* `pending`.
|
|
16
17
|
* @template TQueryFnData - The type your `queryFn` resolves to.
|
|
17
18
|
* @template TError - The type of errors your `queryFn` may throw.
|
|
18
19
|
* @template TData - The type `data` ends up as after `select` runs.
|
|
@@ -38,8 +39,9 @@ export type UndefinedInitialDataOptions<
|
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
/**
|
|
41
|
-
* The options accepted by the `queryOptions` overload selected when
|
|
42
|
-
*
|
|
42
|
+
* The options accepted by the `queryOptions` overload selected when `queryFn` is not `skipToken` and
|
|
43
|
+
* `initialData` is omitted, may be `undefined`, or is a function that may return `undefined` — same as
|
|
44
|
+
* {@link UndefinedInitialDataOptions}, but `queryFn` may not be `skipToken`.
|
|
43
45
|
* @template TQueryFnData - The type your `queryFn` resolves to.
|
|
44
46
|
* @template TError - The type of errors your `queryFn` may throw.
|
|
45
47
|
* @template TData - The type `data` ends up as after `select` runs.
|
|
@@ -55,10 +57,11 @@ export type UnusedSkipTokenOptions<
|
|
|
55
57
|
'queryFn'
|
|
56
58
|
> & {
|
|
57
59
|
/**
|
|
58
|
-
* `skipToken` is not allowed as a value here — this overload is selected when
|
|
59
|
-
* you don't intend to run the query yet,
|
|
60
|
-
*
|
|
61
|
-
*
|
|
60
|
+
* `skipToken` is not allowed as a value here — this overload is selected when `initialData` is omitted, may
|
|
61
|
+
* be `undefined`, or is a function that may return `undefined`. If you don't intend to run the query yet,
|
|
62
|
+
* set `enabled: false` — omitting `queryFn` alone still triggers a fetch that fails with "Missing queryFn"
|
|
63
|
+
* unless `enabled` is `false` or a default query function has been defined. A default query function only
|
|
64
|
+
* supplies `queryFn`; it doesn't defer the fetch on its own.
|
|
62
65
|
*/
|
|
63
66
|
queryFn?: Exclude<
|
|
64
67
|
UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'],
|
|
@@ -67,8 +70,8 @@ export type UnusedSkipTokenOptions<
|
|
|
67
70
|
}
|
|
68
71
|
|
|
69
72
|
/**
|
|
70
|
-
* The options accepted by the `queryOptions` overload selected when `initialData` is
|
|
71
|
-
* `undefined` (unless a `select` changes `TData` to include `undefined`).
|
|
73
|
+
* The options accepted by the `queryOptions` overload selected when `initialData` is known to be defined —
|
|
74
|
+
* `data` is never `undefined` (unless a `select` changes `TData` to include `undefined`).
|
|
72
75
|
* @template TQueryFnData - The type your `queryFn` resolves to.
|
|
73
76
|
* @template TError - The type of errors your `queryFn` may throw.
|
|
74
77
|
* @template TData - The type `data` ends up as after `select` runs.
|
|
@@ -103,9 +106,9 @@ export type DefinedInitialDataOptions<
|
|
|
103
106
|
* be shared across hooks and imperative APIs such as `queryClient.query`. `options.queryKey` is required and
|
|
104
107
|
* is the query key to generate options for.
|
|
105
108
|
*
|
|
106
|
-
* This overload is selected when `initialData` is
|
|
107
|
-
* a `select` changes `TData` to include `undefined`).
|
|
108
|
-
* @param options - The {@link DefinedInitialDataOptions} to use — everything you can pass to `useQuery`, with `initialData`
|
|
109
|
+
* This overload is selected when `initialData` is known to be defined, so the resulting `data` is never
|
|
110
|
+
* `undefined` (unless a `select` changes `TData` to include `undefined`).
|
|
111
|
+
* @param options - The {@link DefinedInitialDataOptions} to use — everything you can pass to `useQuery`, with `initialData` known to be defined.
|
|
109
112
|
* @returns The same options object, typed so that `queryKey` carries the inferred data type.
|
|
110
113
|
* @see {@link useQuery} to run a query with these options.
|
|
111
114
|
* @see [The Query Options API](https://tkdodo.eu/blog/the-query-options-api) for more on this pattern.
|
package/src/useInfiniteQuery.ts
CHANGED
|
@@ -22,8 +22,8 @@ import type {
|
|
|
22
22
|
* The options for `useInfiniteQuery` are identical to `useQuery`, with the addition of
|
|
23
23
|
* `initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`.
|
|
24
24
|
*
|
|
25
|
-
* This overload is selected when `initialData` is
|
|
26
|
-
* @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`, with `initialData`
|
|
25
|
+
* This overload is selected when `initialData` is known to be defined.
|
|
26
|
+
* @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`, with `initialData` known to be defined.
|
|
27
27
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
|
|
28
28
|
* be used.
|
|
29
29
|
* @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,
|
package/src/useIsFetching.ts
CHANGED
|
@@ -39,7 +39,7 @@ import type { QueryClient, QueryFilters } from '@tanstack/query-core'
|
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
41
|
export function useIsFetching(
|
|
42
|
-
filters?: QueryFilters,
|
|
42
|
+
filters?: Omit<QueryFilters, 'fetchStatus'>,
|
|
43
43
|
queryClient?: QueryClient,
|
|
44
44
|
): number {
|
|
45
45
|
const client = useQueryClient(queryClient)
|
package/src/useQuery.ts
CHANGED
|
@@ -13,9 +13,9 @@ import type {
|
|
|
13
13
|
} from './queryOptions'
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* This overload is selected when `initialData` is
|
|
17
|
-
* a `select` changes `TData` to include `undefined`).
|
|
18
|
-
* @param options - The {@link DefinedInitialDataOptions} to use — everything you can pass to `useQuery`, with `initialData`
|
|
16
|
+
* This overload is selected when `initialData` is known to be defined, so the resulting `data` is never
|
|
17
|
+
* `undefined` (unless a `select` changes `TData` to include `undefined`).
|
|
18
|
+
* @param options - The {@link DefinedInitialDataOptions} to use — everything you can pass to `useQuery`, with `initialData` known to be defined.
|
|
19
19
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
|
|
20
20
|
* be used.
|
|
21
21
|
* @returns The current query result, typed so that `status` is `success` — or `error` if a fetch attempt
|
|
@@ -57,8 +57,8 @@ export function useQuery<
|
|
|
57
57
|
): DefinedUseQueryResult<TData, TError>
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
|
-
* This overload is selected when `initialData` is omitted
|
|
61
|
-
* can be `undefined`.
|
|
60
|
+
* This overload is selected when `initialData` is omitted, may be `undefined`, or is a function that may
|
|
61
|
+
* return `undefined`, so the resulting `data` can be `undefined`.
|
|
62
62
|
* @param options - The {@link UndefinedInitialDataOptions} to use — everything you can pass to `useQuery`.
|
|
63
63
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
|
|
64
64
|
* be used.
|