@tanstack/react-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/HydrationBoundary.cjs +2 -3
- package/build/legacy/HydrationBoundary.cjs.map +1 -1
- package/build/legacy/HydrationBoundary.d.cts +2 -3
- package/build/legacy/HydrationBoundary.d.cts.map +1 -1
- package/build/legacy/HydrationBoundary.d.ts +2 -3
- package/build/legacy/HydrationBoundary.d.ts.map +1 -1
- package/build/legacy/HydrationBoundary.js +2 -3
- package/build/legacy/HydrationBoundary.js.map +1 -1
- package/build/legacy/IsRestoringProvider.cjs +0 -1
- package/build/legacy/IsRestoringProvider.cjs.map +1 -1
- package/build/legacy/IsRestoringProvider.d.cts +0 -1
- package/build/legacy/IsRestoringProvider.d.cts.map +1 -1
- package/build/legacy/IsRestoringProvider.d.ts +0 -1
- package/build/legacy/IsRestoringProvider.d.ts.map +1 -1
- package/build/legacy/IsRestoringProvider.js +0 -1
- package/build/legacy/IsRestoringProvider.js.map +1 -1
- package/build/legacy/QueryClientProvider.cjs +3 -4
- package/build/legacy/QueryClientProvider.cjs.map +1 -1
- package/build/legacy/QueryClientProvider.d.cts +3 -4
- package/build/legacy/QueryClientProvider.d.cts.map +1 -1
- package/build/legacy/QueryClientProvider.d.ts +3 -4
- package/build/legacy/QueryClientProvider.d.ts.map +1 -1
- package/build/legacy/QueryClientProvider.js +3 -4
- package/build/legacy/QueryClientProvider.js.map +1 -1
- package/build/legacy/QueryErrorResetBoundary.cjs +5 -5
- package/build/legacy/QueryErrorResetBoundary.cjs.map +1 -1
- package/build/legacy/QueryErrorResetBoundary.d.cts +23 -5
- package/build/legacy/QueryErrorResetBoundary.d.cts.map +1 -1
- package/build/legacy/QueryErrorResetBoundary.d.ts +23 -5
- package/build/legacy/QueryErrorResetBoundary.d.ts.map +1 -1
- package/build/legacy/QueryErrorResetBoundary.js +5 -5
- package/build/legacy/QueryErrorResetBoundary.js.map +1 -1
- package/build/legacy/errorBoundaryUtils.cjs +21 -0
- package/build/legacy/errorBoundaryUtils.cjs.map +1 -1
- package/build/legacy/errorBoundaryUtils.d.cts +21 -0
- package/build/legacy/errorBoundaryUtils.d.cts.map +1 -1
- package/build/legacy/errorBoundaryUtils.d.ts +21 -0
- package/build/legacy/errorBoundaryUtils.d.ts.map +1 -1
- package/build/legacy/errorBoundaryUtils.js +21 -0
- package/build/legacy/errorBoundaryUtils.js.map +1 -1
- package/build/legacy/infiniteQueryOptions.cjs.map +1 -1
- package/build/legacy/infiniteQueryOptions.d.cts +5 -16
- package/build/legacy/infiniteQueryOptions.d.cts.map +1 -1
- package/build/legacy/infiniteQueryOptions.d.ts +5 -16
- package/build/legacy/infiniteQueryOptions.d.ts.map +1 -1
- package/build/legacy/infiniteQueryOptions.js.map +1 -1
- package/build/legacy/mutationOptions.cjs.map +1 -1
- package/build/legacy/mutationOptions.d.cts +2 -6
- package/build/legacy/mutationOptions.d.cts.map +1 -1
- package/build/legacy/mutationOptions.d.ts +2 -6
- package/build/legacy/mutationOptions.d.ts.map +1 -1
- package/build/legacy/mutationOptions.js.map +1 -1
- package/build/legacy/queryOptions.cjs.map +1 -1
- package/build/legacy/queryOptions.d.cts +6 -16
- package/build/legacy/queryOptions.d.cts.map +1 -1
- package/build/legacy/queryOptions.d.ts +6 -16
- package/build/legacy/queryOptions.d.ts.map +1 -1
- package/build/legacy/queryOptions.js.map +1 -1
- package/build/legacy/suspense.cjs +27 -0
- package/build/legacy/suspense.cjs.map +1 -1
- package/build/legacy/suspense.d.cts +27 -0
- package/build/legacy/suspense.d.cts.map +1 -1
- package/build/legacy/suspense.d.ts +27 -0
- package/build/legacy/suspense.d.ts.map +1 -1
- package/build/legacy/suspense.js +27 -0
- package/build/legacy/suspense.js.map +1 -1
- package/build/legacy/types.cjs.map +1 -1
- package/build/legacy/types.d.cts +2 -22
- package/build/legacy/types.d.cts.map +1 -1
- package/build/legacy/types.d.ts +2 -22
- package/build/legacy/types.d.ts.map +1 -1
- package/build/legacy/types.js.map +1 -1
- package/build/legacy/useBaseQuery.cjs +13 -0
- package/build/legacy/useBaseQuery.cjs.map +1 -1
- package/build/legacy/useBaseQuery.d.cts +13 -0
- package/build/legacy/useBaseQuery.d.cts.map +1 -1
- package/build/legacy/useBaseQuery.d.ts +13 -0
- package/build/legacy/useBaseQuery.d.ts.map +1 -1
- package/build/legacy/useBaseQuery.js +13 -0
- package/build/legacy/useBaseQuery.js.map +1 -1
- package/build/legacy/useInfiniteQuery.cjs.map +1 -1
- package/build/legacy/useInfiniteQuery.d.cts +12 -21
- package/build/legacy/useInfiniteQuery.d.cts.map +1 -1
- package/build/legacy/useInfiniteQuery.d.ts +12 -21
- package/build/legacy/useInfiniteQuery.d.ts.map +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 +0 -3
- package/build/legacy/useIsFetching.d.cts.map +1 -1
- package/build/legacy/useIsFetching.d.ts +0 -3
- 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 +4 -8
- package/build/legacy/useMutation.cjs.map +1 -1
- package/build/legacy/useMutation.d.cts +4 -8
- package/build/legacy/useMutation.d.cts.map +1 -1
- package/build/legacy/useMutation.d.ts +4 -8
- package/build/legacy/useMutation.d.ts.map +1 -1
- package/build/legacy/useMutation.js +4 -8
- package/build/legacy/useMutation.js.map +1 -1
- package/build/legacy/useMutationState.cjs +13 -12
- package/build/legacy/useMutationState.cjs.map +1 -1
- package/build/legacy/useMutationState.d.cts +0 -6
- package/build/legacy/useMutationState.d.cts.map +1 -1
- package/build/legacy/useMutationState.d.ts +0 -6
- package/build/legacy/useMutationState.d.ts.map +1 -1
- package/build/legacy/useMutationState.js +13 -12
- package/build/legacy/useMutationState.js.map +1 -1
- package/build/legacy/usePrefetchInfiniteQuery.cjs +0 -3
- package/build/legacy/usePrefetchInfiniteQuery.cjs.map +1 -1
- package/build/legacy/usePrefetchInfiniteQuery.d.cts +0 -3
- package/build/legacy/usePrefetchInfiniteQuery.d.cts.map +1 -1
- package/build/legacy/usePrefetchInfiniteQuery.d.ts +0 -3
- package/build/legacy/usePrefetchInfiniteQuery.d.ts.map +1 -1
- package/build/legacy/usePrefetchInfiniteQuery.js +0 -3
- package/build/legacy/usePrefetchInfiniteQuery.js.map +1 -1
- package/build/legacy/usePrefetchQuery.cjs +0 -3
- package/build/legacy/usePrefetchQuery.cjs.map +1 -1
- package/build/legacy/usePrefetchQuery.d.cts +0 -3
- package/build/legacy/usePrefetchQuery.d.cts.map +1 -1
- package/build/legacy/usePrefetchQuery.d.ts +0 -3
- package/build/legacy/usePrefetchQuery.d.ts.map +1 -1
- package/build/legacy/usePrefetchQuery.js +0 -3
- package/build/legacy/usePrefetchQuery.js.map +1 -1
- package/build/legacy/useQueries.cjs +7 -8
- package/build/legacy/useQueries.cjs.map +1 -1
- package/build/legacy/useQueries.d.cts +7 -11
- package/build/legacy/useQueries.d.cts.map +1 -1
- package/build/legacy/useQueries.d.ts +7 -11
- package/build/legacy/useQueries.d.ts.map +1 -1
- package/build/legacy/useQueries.js +7 -8
- package/build/legacy/useQueries.js.map +1 -1
- package/build/legacy/useQuery.cjs.map +1 -1
- package/build/legacy/useQuery.d.cts +8 -13
- package/build/legacy/useQuery.d.cts.map +1 -1
- package/build/legacy/useQuery.d.ts +8 -13
- package/build/legacy/useQuery.d.ts.map +1 -1
- package/build/legacy/useQuery.js.map +1 -1
- package/build/legacy/useSuspenseInfiniteQuery.cjs +6 -8
- package/build/legacy/useSuspenseInfiniteQuery.cjs.map +1 -1
- package/build/legacy/useSuspenseInfiniteQuery.d.cts +6 -8
- package/build/legacy/useSuspenseInfiniteQuery.d.cts.map +1 -1
- package/build/legacy/useSuspenseInfiniteQuery.d.ts +6 -8
- package/build/legacy/useSuspenseInfiniteQuery.d.ts.map +1 -1
- package/build/legacy/useSuspenseInfiniteQuery.js +6 -8
- package/build/legacy/useSuspenseInfiniteQuery.js.map +1 -1
- package/build/legacy/useSuspenseQueries.cjs.map +1 -1
- package/build/legacy/useSuspenseQueries.d.cts +0 -9
- package/build/legacy/useSuspenseQueries.d.cts.map +1 -1
- package/build/legacy/useSuspenseQueries.d.ts +0 -9
- package/build/legacy/useSuspenseQueries.d.ts.map +1 -1
- package/build/legacy/useSuspenseQueries.js.map +1 -1
- package/build/legacy/useSuspenseQuery.cjs +4 -6
- package/build/legacy/useSuspenseQuery.cjs.map +1 -1
- package/build/legacy/useSuspenseQuery.d.cts +4 -6
- package/build/legacy/useSuspenseQuery.d.cts.map +1 -1
- package/build/legacy/useSuspenseQuery.d.ts +4 -6
- package/build/legacy/useSuspenseQuery.d.ts.map +1 -1
- package/build/legacy/useSuspenseQuery.js +4 -6
- package/build/legacy/useSuspenseQuery.js.map +1 -1
- package/build/modern/HydrationBoundary.cjs +2 -3
- package/build/modern/HydrationBoundary.cjs.map +1 -1
- package/build/modern/HydrationBoundary.d.cts +2 -3
- package/build/modern/HydrationBoundary.d.cts.map +1 -1
- package/build/modern/HydrationBoundary.d.ts +2 -3
- package/build/modern/HydrationBoundary.d.ts.map +1 -1
- package/build/modern/HydrationBoundary.js +2 -3
- package/build/modern/HydrationBoundary.js.map +1 -1
- package/build/modern/IsRestoringProvider.cjs +0 -1
- package/build/modern/IsRestoringProvider.cjs.map +1 -1
- package/build/modern/IsRestoringProvider.d.cts +0 -1
- package/build/modern/IsRestoringProvider.d.cts.map +1 -1
- package/build/modern/IsRestoringProvider.d.ts +0 -1
- package/build/modern/IsRestoringProvider.d.ts.map +1 -1
- package/build/modern/IsRestoringProvider.js +0 -1
- package/build/modern/IsRestoringProvider.js.map +1 -1
- package/build/modern/QueryClientProvider.cjs +3 -4
- package/build/modern/QueryClientProvider.cjs.map +1 -1
- package/build/modern/QueryClientProvider.d.cts +3 -4
- package/build/modern/QueryClientProvider.d.cts.map +1 -1
- package/build/modern/QueryClientProvider.d.ts +3 -4
- package/build/modern/QueryClientProvider.d.ts.map +1 -1
- package/build/modern/QueryClientProvider.js +3 -4
- package/build/modern/QueryClientProvider.js.map +1 -1
- package/build/modern/QueryErrorResetBoundary.cjs +5 -5
- package/build/modern/QueryErrorResetBoundary.cjs.map +1 -1
- package/build/modern/QueryErrorResetBoundary.d.cts +23 -5
- package/build/modern/QueryErrorResetBoundary.d.cts.map +1 -1
- package/build/modern/QueryErrorResetBoundary.d.ts +23 -5
- package/build/modern/QueryErrorResetBoundary.d.ts.map +1 -1
- package/build/modern/QueryErrorResetBoundary.js +5 -5
- package/build/modern/QueryErrorResetBoundary.js.map +1 -1
- package/build/modern/errorBoundaryUtils.cjs +21 -0
- package/build/modern/errorBoundaryUtils.cjs.map +1 -1
- package/build/modern/errorBoundaryUtils.d.cts +21 -0
- package/build/modern/errorBoundaryUtils.d.cts.map +1 -1
- package/build/modern/errorBoundaryUtils.d.ts +21 -0
- package/build/modern/errorBoundaryUtils.d.ts.map +1 -1
- package/build/modern/errorBoundaryUtils.js +21 -0
- package/build/modern/errorBoundaryUtils.js.map +1 -1
- package/build/modern/infiniteQueryOptions.cjs.map +1 -1
- package/build/modern/infiniteQueryOptions.d.cts +5 -16
- package/build/modern/infiniteQueryOptions.d.cts.map +1 -1
- package/build/modern/infiniteQueryOptions.d.ts +5 -16
- package/build/modern/infiniteQueryOptions.d.ts.map +1 -1
- package/build/modern/infiniteQueryOptions.js.map +1 -1
- package/build/modern/mutationOptions.cjs.map +1 -1
- package/build/modern/mutationOptions.d.cts +2 -6
- package/build/modern/mutationOptions.d.cts.map +1 -1
- package/build/modern/mutationOptions.d.ts +2 -6
- package/build/modern/mutationOptions.d.ts.map +1 -1
- package/build/modern/mutationOptions.js.map +1 -1
- package/build/modern/queryOptions.cjs.map +1 -1
- package/build/modern/queryOptions.d.cts +6 -16
- package/build/modern/queryOptions.d.cts.map +1 -1
- package/build/modern/queryOptions.d.ts +6 -16
- package/build/modern/queryOptions.d.ts.map +1 -1
- package/build/modern/queryOptions.js.map +1 -1
- package/build/modern/suspense.cjs +27 -0
- package/build/modern/suspense.cjs.map +1 -1
- package/build/modern/suspense.d.cts +27 -0
- package/build/modern/suspense.d.cts.map +1 -1
- package/build/modern/suspense.d.ts +27 -0
- package/build/modern/suspense.d.ts.map +1 -1
- package/build/modern/suspense.js +27 -0
- package/build/modern/suspense.js.map +1 -1
- package/build/modern/types.cjs.map +1 -1
- package/build/modern/types.d.cts +2 -22
- package/build/modern/types.d.cts.map +1 -1
- package/build/modern/types.d.ts +2 -22
- package/build/modern/types.d.ts.map +1 -1
- package/build/modern/types.js.map +1 -1
- package/build/modern/useBaseQuery.cjs +13 -0
- package/build/modern/useBaseQuery.cjs.map +1 -1
- package/build/modern/useBaseQuery.d.cts +13 -0
- package/build/modern/useBaseQuery.d.cts.map +1 -1
- package/build/modern/useBaseQuery.d.ts +13 -0
- package/build/modern/useBaseQuery.d.ts.map +1 -1
- package/build/modern/useBaseQuery.js +13 -0
- package/build/modern/useBaseQuery.js.map +1 -1
- package/build/modern/useInfiniteQuery.cjs.map +1 -1
- package/build/modern/useInfiniteQuery.d.cts +12 -21
- package/build/modern/useInfiniteQuery.d.cts.map +1 -1
- package/build/modern/useInfiniteQuery.d.ts +12 -21
- package/build/modern/useInfiniteQuery.d.ts.map +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 +0 -3
- package/build/modern/useIsFetching.d.cts.map +1 -1
- package/build/modern/useIsFetching.d.ts +0 -3
- 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 +4 -8
- package/build/modern/useMutation.cjs.map +1 -1
- package/build/modern/useMutation.d.cts +4 -8
- package/build/modern/useMutation.d.cts.map +1 -1
- package/build/modern/useMutation.d.ts +4 -8
- package/build/modern/useMutation.d.ts.map +1 -1
- package/build/modern/useMutation.js +4 -8
- package/build/modern/useMutation.js.map +1 -1
- package/build/modern/useMutationState.cjs +13 -12
- package/build/modern/useMutationState.cjs.map +1 -1
- package/build/modern/useMutationState.d.cts +0 -6
- package/build/modern/useMutationState.d.cts.map +1 -1
- package/build/modern/useMutationState.d.ts +0 -6
- package/build/modern/useMutationState.d.ts.map +1 -1
- package/build/modern/useMutationState.js +13 -12
- package/build/modern/useMutationState.js.map +1 -1
- package/build/modern/usePrefetchInfiniteQuery.cjs +0 -3
- package/build/modern/usePrefetchInfiniteQuery.cjs.map +1 -1
- package/build/modern/usePrefetchInfiniteQuery.d.cts +0 -3
- package/build/modern/usePrefetchInfiniteQuery.d.cts.map +1 -1
- package/build/modern/usePrefetchInfiniteQuery.d.ts +0 -3
- package/build/modern/usePrefetchInfiniteQuery.d.ts.map +1 -1
- package/build/modern/usePrefetchInfiniteQuery.js +0 -3
- package/build/modern/usePrefetchInfiniteQuery.js.map +1 -1
- package/build/modern/usePrefetchQuery.cjs +0 -3
- package/build/modern/usePrefetchQuery.cjs.map +1 -1
- package/build/modern/usePrefetchQuery.d.cts +0 -3
- package/build/modern/usePrefetchQuery.d.cts.map +1 -1
- package/build/modern/usePrefetchQuery.d.ts +0 -3
- package/build/modern/usePrefetchQuery.d.ts.map +1 -1
- package/build/modern/usePrefetchQuery.js +0 -3
- package/build/modern/usePrefetchQuery.js.map +1 -1
- package/build/modern/useQueries.cjs +7 -8
- package/build/modern/useQueries.cjs.map +1 -1
- package/build/modern/useQueries.d.cts +7 -11
- package/build/modern/useQueries.d.cts.map +1 -1
- package/build/modern/useQueries.d.ts +7 -11
- package/build/modern/useQueries.d.ts.map +1 -1
- package/build/modern/useQueries.js +7 -8
- package/build/modern/useQueries.js.map +1 -1
- package/build/modern/useQuery.cjs.map +1 -1
- package/build/modern/useQuery.d.cts +8 -13
- package/build/modern/useQuery.d.cts.map +1 -1
- package/build/modern/useQuery.d.ts +8 -13
- package/build/modern/useQuery.d.ts.map +1 -1
- package/build/modern/useQuery.js.map +1 -1
- package/build/modern/useSuspenseInfiniteQuery.cjs +6 -8
- package/build/modern/useSuspenseInfiniteQuery.cjs.map +1 -1
- package/build/modern/useSuspenseInfiniteQuery.d.cts +6 -8
- package/build/modern/useSuspenseInfiniteQuery.d.cts.map +1 -1
- package/build/modern/useSuspenseInfiniteQuery.d.ts +6 -8
- package/build/modern/useSuspenseInfiniteQuery.d.ts.map +1 -1
- package/build/modern/useSuspenseInfiniteQuery.js +6 -8
- package/build/modern/useSuspenseInfiniteQuery.js.map +1 -1
- package/build/modern/useSuspenseQueries.cjs.map +1 -1
- package/build/modern/useSuspenseQueries.d.cts +0 -9
- package/build/modern/useSuspenseQueries.d.cts.map +1 -1
- package/build/modern/useSuspenseQueries.d.ts +0 -9
- package/build/modern/useSuspenseQueries.d.ts.map +1 -1
- package/build/modern/useSuspenseQueries.js.map +1 -1
- package/build/modern/useSuspenseQuery.cjs +4 -6
- package/build/modern/useSuspenseQuery.cjs.map +1 -1
- package/build/modern/useSuspenseQuery.d.cts +4 -6
- package/build/modern/useSuspenseQuery.d.cts.map +1 -1
- package/build/modern/useSuspenseQuery.d.ts +4 -6
- package/build/modern/useSuspenseQuery.d.ts.map +1 -1
- package/build/modern/useSuspenseQuery.js +4 -6
- package/build/modern/useSuspenseQuery.js.map +1 -1
- package/package.json +10 -8
- package/src/HydrationBoundary.tsx +4 -5
- package/src/IsRestoringProvider.ts +0 -1
- package/src/QueryClientProvider.tsx +3 -4
- package/src/QueryErrorResetBoundary.tsx +30 -6
- package/src/errorBoundaryUtils.ts +21 -0
- package/src/infiniteQueryOptions.ts +5 -16
- package/src/mutationOptions.ts +2 -6
- package/src/queryOptions.ts +8 -17
- package/src/suspense.ts +29 -1
- package/src/types.ts +2 -22
- package/src/useBaseQuery.ts +13 -0
- package/src/useInfiniteQuery.ts +12 -21
- package/src/useIsFetching.ts +0 -3
- package/src/useMutation.ts +4 -8
- package/src/useMutationState.ts +15 -14
- package/src/usePrefetchInfiniteQuery.tsx +0 -3
- package/src/usePrefetchQuery.tsx +0 -3
- package/src/useQueries.ts +7 -11
- package/src/useQuery.ts +8 -13
- package/src/useSuspenseInfiniteQuery.ts +6 -8
- package/src/useSuspenseQueries.ts +0 -9
- package/src/useSuspenseQuery.ts +4 -6
|
@@ -20,7 +20,12 @@ import type {
|
|
|
20
20
|
* `enabled`, and `placeholderData`.
|
|
21
21
|
*
|
|
22
22
|
* Caveat: cancellation does not work.
|
|
23
|
-
*
|
|
23
|
+
* @param options - The {@link UseSuspenseInfiniteQueryOptions} to use — the same options as `useInfiniteQuery`, minus the ones listed above.
|
|
24
|
+
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
|
|
25
|
+
* be used.
|
|
26
|
+
* @returns The same object as `useInfiniteQuery`, except that `data` is guaranteed to be defined,
|
|
27
|
+
* `isPlaceholderData` is missing, and `status` is either `success` or `error` (with the derived flags set
|
|
28
|
+
* accordingly).
|
|
24
29
|
* @remarks Multiple suspenseful query calls in the same component suspend serially, causing a request
|
|
25
30
|
* waterfall — each one blocks rendering until it resolves, so the next doesn't even start fetching until
|
|
26
31
|
* then. There's no way to parallelize multiple infinite queries under Suspense. Also keep in mind that
|
|
@@ -28,13 +33,6 @@ import type {
|
|
|
28
33
|
* resulting in outdated data. Make sure to call these functions only in response to user actions, or add
|
|
29
34
|
* conditions like `hasNextPage && !isFetching`.
|
|
30
35
|
* @see {@link useInfiniteQuery} for the non-Suspense version of this hook.
|
|
31
|
-
* @param options - The {@link UseSuspenseInfiniteQueryOptions} to use — the same options as `useInfiniteQuery`, minus the ones listed above.
|
|
32
|
-
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
|
|
33
|
-
* be used.
|
|
34
|
-
* @returns The same object as `useInfiniteQuery`, except that `data` is guaranteed to be defined,
|
|
35
|
-
* `isPlaceholderData` is missing, and `status` is either `success` or `error` (with the derived flags set
|
|
36
|
-
* accordingly).
|
|
37
|
-
*
|
|
38
36
|
* @example
|
|
39
37
|
* The query error is thrown if a fetch fails and no cached data exists yet, so an error boundary is
|
|
40
38
|
* required around `<Suspense>`. A failed background refetch instead continues to render the cached data.
|
|
@@ -113,7 +113,6 @@ type GetUseSuspenseQueryResult<T> =
|
|
|
113
113
|
* matches a query options object is mapped per-element instead, still inferring each entry individually; any
|
|
114
114
|
* other non-tuple array — one whose element type doesn't match the expected options shape — falls back to
|
|
115
115
|
* that same homogeneous options type too.
|
|
116
|
-
*
|
|
117
116
|
* @template T - The type of the `queries` array as written at the call site.
|
|
118
117
|
* @template TResults - The internal accumulator that this type builds during recursion. It is not meant
|
|
119
118
|
* to be set explicitly.
|
|
@@ -159,7 +158,6 @@ export type SuspenseQueriesOptions<
|
|
|
159
158
|
* {@link SuspenseQueriesOptions}: each tuple element's result type is inferred individually, up to 20 elements.
|
|
160
159
|
* A non-tuple array is mapped per-element instead, still inferring each entry individually; only past 20
|
|
161
160
|
* elements does this fall back to a single homogeneous {@link UseSuspenseQueryResult} type.
|
|
162
|
-
*
|
|
163
161
|
* @template T - The type of the `queries` array, as inferred by {@link SuspenseQueriesOptions}.
|
|
164
162
|
* @template TResults - The internal accumulator that this type builds during recursion. It is not meant
|
|
165
163
|
* to be set explicitly.
|
|
@@ -187,7 +185,6 @@ export type SuspenseQueriesResults<
|
|
|
187
185
|
/**
|
|
188
186
|
* The options for `useSuspenseQueries` are the same as for `useQueries`, except that the top-level `subscribed`
|
|
189
187
|
* option isn't supported, and each `query` can't have `throwOnError`, `enabled`, or `placeholderData`.
|
|
190
|
-
*
|
|
191
188
|
* @param options - The `queries` array to run in Suspense, and an optional `combine` function.
|
|
192
189
|
* @param queryClient - Use this to provide a custom `QueryClient`. Otherwise, the one from the nearest context
|
|
193
190
|
* will be used.
|
|
@@ -198,7 +195,6 @@ export type SuspenseQueriesResults<
|
|
|
198
195
|
* Caveat: the component will only re-mount after all queries have finished loading. Hence, if a query has gone
|
|
199
196
|
* stale in the time it took for all the queries to complete, it will be fetched again at re-mount. To avoid
|
|
200
197
|
* this, make sure to set a high enough `staleTime`. Cancellation does not work.
|
|
201
|
-
*
|
|
202
198
|
* @example
|
|
203
199
|
* The query error is thrown if a fetch fails and no cached data exists yet, so an error boundary is
|
|
204
200
|
* required around `<Suspense>`. A failed background refetch instead continues to render the cached data.
|
|
@@ -251,7 +247,6 @@ export type SuspenseQueriesResults<
|
|
|
251
247
|
* )
|
|
252
248
|
* }
|
|
253
249
|
* ```
|
|
254
|
-
*
|
|
255
250
|
* @example
|
|
256
251
|
* Several different queries — use `useSuspenseQueries` instead of multiple `useSuspenseQuery` calls, so
|
|
257
252
|
* they fetch in parallel rather than suspending one after another:
|
|
@@ -303,7 +298,6 @@ export type SuspenseQueriesResults<
|
|
|
303
298
|
* )
|
|
304
299
|
* }
|
|
305
300
|
* ```
|
|
306
|
-
*
|
|
307
301
|
* @example
|
|
308
302
|
* `combine`s the results into a single boolean, so `Refresh` only re-renders when that boolean changes,
|
|
309
303
|
* not on every individual query update. This overload is the only one that accepts `combine`:
|
|
@@ -373,7 +367,6 @@ export function useSuspenseQueries<
|
|
|
373
367
|
/**
|
|
374
368
|
* The options for `useSuspenseQueries` are the same as for `useQueries`, except that the top-level `subscribed`
|
|
375
369
|
* option isn't supported, and each `query` can't have `throwOnError`, `enabled`, or `placeholderData`.
|
|
376
|
-
*
|
|
377
370
|
* @param options - The `queries` array to run in Suspense, and an optional `combine` function.
|
|
378
371
|
* @param queryClient - Use this to provide a custom `QueryClient`. Otherwise, the one from the nearest context
|
|
379
372
|
* will be used.
|
|
@@ -384,7 +377,6 @@ export function useSuspenseQueries<
|
|
|
384
377
|
* Caveat: the component will only re-mount after all queries have finished loading. Hence, if a query has gone
|
|
385
378
|
* stale in the time it took for all the queries to complete, it will be fetched again at re-mount. To avoid
|
|
386
379
|
* this, make sure to set a high enough `staleTime`. Cancellation does not work.
|
|
387
|
-
*
|
|
388
380
|
* @example
|
|
389
381
|
* The query error is thrown if a fetch fails and no cached data exists yet, so an error boundary is
|
|
390
382
|
* required around `<Suspense>`. A failed background refetch instead continues to render the cached data.
|
|
@@ -437,7 +429,6 @@ export function useSuspenseQueries<
|
|
|
437
429
|
* )
|
|
438
430
|
* }
|
|
439
431
|
* ```
|
|
440
|
-
*
|
|
441
432
|
* @example
|
|
442
433
|
* Several different queries — use `useSuspenseQueries` instead of multiple `useSuspenseQuery` calls, so
|
|
443
434
|
* they fetch in parallel rather than suspending one after another:
|
package/src/useSuspenseQuery.ts
CHANGED
|
@@ -10,17 +10,15 @@ import type { DefaultError, QueryClient, QueryKey } from '@tanstack/query-core'
|
|
|
10
10
|
* `placeholderData` — and `queryFn` may not be `skipToken`, since Suspense hooks can't render a "disabled" state.
|
|
11
11
|
*
|
|
12
12
|
* Caveat: cancellation does not work.
|
|
13
|
-
*
|
|
14
|
-
* @remarks Multiple `useSuspenseQuery` calls in the same component suspend serially, causing a request
|
|
15
|
-
* waterfall — each one blocks rendering until it resolves, so the next doesn't even start fetching until then.
|
|
16
|
-
* Use {@link useSuspenseQueries} instead when you have more than one suspenseful query in a component, so they
|
|
17
|
-
* fetch in parallel.
|
|
18
13
|
* @param options - The {@link UseSuspenseQueryOptions} to use — the same options as `useQuery`, minus the ones listed above.
|
|
19
14
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
|
|
20
15
|
* be used.
|
|
21
16
|
* @returns The same object as `useQuery`, except that `data` is guaranteed to be defined, `isPlaceholderData`
|
|
22
17
|
* is missing, and `status` is either `success` or `error` (with the derived flags set accordingly).
|
|
23
|
-
*
|
|
18
|
+
* @remarks Multiple `useSuspenseQuery` calls in the same component suspend serially, causing a request
|
|
19
|
+
* waterfall — each one blocks rendering until it resolves, so the next doesn't even start fetching until then.
|
|
20
|
+
* Use {@link useSuspenseQueries} instead when you have more than one suspenseful query in a component, so they
|
|
21
|
+
* fetch in parallel.
|
|
24
22
|
* @example
|
|
25
23
|
* The query error is thrown if the fetch fails and no cached data exists yet, so an error boundary is
|
|
26
24
|
* required around `<Suspense>`. A failed background refetch instead continues to render the cached data.
|