Infinite queries topic

Paged data: InfiniteQueryOptions with a page function and getNextPageParam, held in the cache as InfiniteData and observed with an InfiniteQueryObserver, which fetches the next or previous page on request.

Classes

InfiniteData<TPageData, TPageParam> Infinite queries
The data an infinite query holds: every page fetched so far, and the param each was fetched with.
InfinitePageContext<TPageParam> Infinite queries
What a page function (InfiniteQueryOptions.pageFn) is handed: the param of the page to fetch, the direction, and the query's key, client, meta and cancellation token.
InfiniteQueryObserverOptions<TPageData, TPageParam> Infinite queries
Observer options for a plain infinite query: no select, so the observer reports the InfiniteData the query holds, and two type arguments — the page and its param — name everything.
InfiniteQueryObserverOptionsBase<TPageData, TPageParam, TData> Infinite queries
InfiniteQueryOptions plus the observer-only options: select, placeholderData, the refetchOn* triggers, polling and retryOnMount.
InfiniteQueryOptions<TPageData, TPageParam> Infinite queries
Everything that describes an infinite query at the cache layer: a list whose pages are fetched one at a time, "load more" style.
InfiniteQuerySelectOptions<TPageData, TPageParam, TData> Infinite queries
Observer options for an infinite query whose observers see a projection of the pages: select is required and anchors TData.

Typedefs

InfinitePageFn<TPageData, TPageParam> = FutureOr<TPageData> Function(InfinitePageContext<TPageParam> context) Infinite queries
Fetches one page, given the context that names its param — the page function of an infinite query (InfiniteQueryOptions.pageFn).
PageParamFn<TPageData, TPageParam> = TPageParam? Function(TPageData page, List<TPageData> pages, TPageParam pageParam, List<TPageParam> pageParams) Infinite queries
Where the next (or previous) page starts, or null when there is none.