Skip to content

DefinedInitialDataInfiniteOptions

ts
type DefinedInitialDataInfiniteOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = CreateInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & object;

Defined in: packages/angular-query-experimental/src/infinite-query-options.ts:108

The options accepted by the infiniteQueryOptions overload selected when initialData is known to be defined — data is never undefined (unless a select changes TData to include undefined).

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.

Type Declaration

initialData

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

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.