Options topic
What a query is and how it behaves. QueryOptions describe the cache entry (key, query function, staleness, retries); QueryObserverOptions add what an observer does (refetch triggers, polling, placeholder data), and QuerySelectOptions add a select that changes the type observers see. Every field left null takes the client's default.
Classes
-
QueryObserverOptions<
TData> -
Observer options for a plain query: no
select, so the observer reports the query's data as its own, and one type argument names both. -
QueryObserverOptionsBase<
TQueryData, TData> - QueryOptions plus everything only an observer cares about: when to refetch (refetchOnMount, refetchOnWindowFocus, refetchOnReconnect, refetchInterval, refetchIntervalInBackground, retryOnMount), what to show while there is no data (placeholderData), and what part of the data to report (select).
-
QueryOptions<
TQueryData> - Everything the cache entry for a query needs: its queryKey, the queryFn that fetches it, and how long and how hard to keep it — staleTime, gcTime, retry, retryDelay, networkMode, enabled, initialData, structuralSharing and meta.
-
QuerySelectOptions<
TQueryData, TData> -
Observer options for a query whose observers see a projection of the
cached data: what the cache holds (
TQueryData) and what select makes of it (TData) — two type arguments, both anchored,TDataby the required select.