Queries topic

A query is one cache entry: data fetched by a query function under a QueryKey. QueryState is what the entry holds; the query function receives a QueryFunctionContext with a QueryCancelToken for cancellation.

Classes

Query<TQueryData> Queries
One cache entry: a key, its options, its state, and the fetch machinery.
QueryCancelToken Queries
Handed to a query function, as QueryFunctionContext.signal, so it can abort work that is no longer wanted.
QueryFunctionContext Queries
What a query function is handed: the client, the queryKey being fetched, the query's meta, and a cancel token, signal.
QueryKey Queries
An immutable, structurally compared cache key: what identifies a query in the cache.
QueryState<TQueryData> Queries
Everything a query holds at one point in time: its data or error, its status and fetchStatus, and the counters and timestamps behind them.

Enums

FetchDirection Queries
Which end of an infinite query is being fetched.
FetchStatus Queries
What a query is doing right now: fetching, paused, or nothing.
QueryStatus Queries
What a query holds: nothing yet, data, or an error.

Typedefs

QueryFn<TQueryData> = FutureOr<TQueryData> Function(QueryFunctionContext context) Queries
The function a query runs to get its data: handed a QueryFunctionContext, it returns the data or a future of it. A throw fails the attempt, which QueryOptions.retry may then retry.
SelectFn<TQueryData, TData> = TData Function(TQueryData data) Queries
Projects a query's data into what an observer reports — the select of a QuerySelectOptions. It runs on the observer's side, so every observer of one query may select something different from the same cached data.