File tree Expand file tree Collapse file tree 2 files changed +29
-14
lines changed
Expand file tree Collapse file tree 2 files changed +29
-14
lines changed Original file line number Diff line number Diff line change 11'use client'
2- import { InfiniteQueryObserver } from '@tanstack/query-core'
2+ import { InfiniteQueryObserver , skipToken } from '@tanstack/query-core'
33import { useBaseQuery } from './useBaseQuery'
44import { defaultThrowOnError } from './suspense'
55import type {
@@ -32,6 +32,12 @@ export function useSuspenseInfiniteQuery<
3232 > ,
3333 queryClient ?: QueryClient ,
3434) : UseSuspenseInfiniteQueryResult < TData , TError > {
35+ if ( process . env . NODE_ENV !== 'production' ) {
36+ if ( options . queryFn === skipToken ) {
37+ console . error ( 'skipToken is not allowed for useSuspenseInfiniteQuery' )
38+ }
39+ }
40+
3541 return useBaseQuery (
3642 {
3743 ...options ,
Original file line number Diff line number Diff line change 11'use client'
2+ import {
3+ type DefaultError ,
4+ type QueryClient ,
5+ type QueryFunction ,
6+ type ThrowOnError ,
7+ skipToken ,
8+ } from '@tanstack/query-core'
29import { useQueries } from './useQueries'
310import { defaultThrowOnError } from './suspense'
411import type { UseSuspenseQueryOptions , UseSuspenseQueryResult } from './types'
5- import type {
6- DefaultError ,
7- QueryClient ,
8- QueryFunction ,
9- ThrowOnError ,
10- } from '@tanstack/query-core'
1112
1213// Avoid TS depth-limit error in case of large array literal
1314type MAXIMUM_DEPTH = 20
@@ -190,13 +191,21 @@ export function useSuspenseQueries<
190191 return useQueries (
191192 {
192193 ...options ,
193- queries : options . queries . map ( ( query ) => ( {
194- ...query ,
195- suspense : true ,
196- throwOnError : defaultThrowOnError ,
197- enabled : true ,
198- placeholderData : undefined ,
199- } ) ) ,
194+ queries : options . queries . map ( ( query ) => {
195+ if ( process . env . NODE_ENV !== 'production' ) {
196+ if ( query . queryFn === skipToken ) {
197+ console . error ( 'skipToken is not allowed for useSuspenseQueries' )
198+ }
199+ }
200+
201+ return {
202+ ...query ,
203+ suspense : true ,
204+ throwOnError : defaultThrowOnError ,
205+ enabled : true ,
206+ placeholderData : undefined ,
207+ }
208+ } ) ,
200209 } as any ,
201210 queryClient ,
202211 )
You can’t perform that action at this time.
0 commit comments