Przejdź do głównej zawartości

Interface: StorefrontQueryState<TResult>

State a query adapter returns for one read — the shape both the lite and library adapters expose.

Type Parameters

TResult

TResult

Properties

data

data: TResult | undefined


error

error: StorefrontError | null

Last error for the current key, or null.


isError

isError: boolean


isFetching

isFetching: boolean

A request is in flight (first load or a refetch).


isLoading

isLoading: boolean

A request is in flight AND there is no data yet (isPending && isFetching) — the right gate for a first-load spinner. false when the query is gated off, so a signed-out account read shows its empty state instead of an endless spinner.


isPending

isPending: boolean

true until the current inputs settle for the first time — INCLUDING while the query is gated off (enabled: false). For a loading spinner use isLoading, not this, or a gated (e.g. signed-out) query would render a spinner forever.


isSuccess

isSuccess: boolean


refetch

refetch: () => void

Re-run the read for the current inputs. Stable reference.

Returns

void