TanStack
API Reference

UsePrefetchInfiniteQueryOptions

ts
type UsePrefetchInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> = DistributiveOmit<InfiniteQueryExecuteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, "queryFn"> & object;

Defined in: packages/preact-query/src/types.ts:117

The options accepted by usePrefetchInfiniteQuery — everything you can pass to queryClient.infiniteQuery, except queryFn is required unless a default query function has been defined.

Type Declaration

queryFn?

ts
optional queryFn: Exclude<InfiniteQueryExecuteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>["queryFn"], SkipToken>;

skipToken is not allowed as a value here — a prefetch always needs a query function to actually run, unless a default query function has been defined.

Type Parameters

TQueryFnData

TQueryFnData = unknown

The type of a single page, as your queryFn resolves it.

TError

TError = DefaultError

The type of errors your queryFn may throw.

TData

TData = TQueryFnData

The type data ends up as after select runs. Defaults to TQueryFnData (a single page) here, since a prefetch never reads data back out — this parameter only matters if you reuse these options elsewhere with select applied.

TQueryKey

TQueryKey extends QueryKey = QueryKey

The type of your queryKey.

TPageParam

TPageParam = unknown

The type of the parameter passed to queryFn to fetch a given page.