TanStack
API Reference

DefinedInitialDataInfiniteOptions

ts
type DefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> = UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & object;

Defined in: packages/preact-query/src/infiniteQueryOptions.ts:104

The options accepted by the infiniteQueryOptions overload selected when initialData is set — data is never undefined.

Type Declaration

initialData

ts
initialData: 
  | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>
  | () => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>
  | undefined;

If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet). If set to a function, the function will be called once during the shared/root query initialization, and be expected to synchronously return the initial data. Initial data is considered stale by default unless a staleTime has been set. initialData is persisted to the cache.

Type Parameters

TQueryFnData

TQueryFnData

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

TError

TError = DefaultError

The type of errors your queryFn may throw.

TData

TData = InfiniteData<TQueryFnData>

The type data ends up as after select runs — defaults to InfiniteData<TQueryFnData>, the shape of all fetched pages plus their page params.

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.