Skip to main content
query() creates a reactive data-fetching primitive. Pass it a SDK method call and it returns reactive properties (data, loading, error) that auto-update in the DOM. It supports SSR data pre-fetching and integrates with the entity store for cross-component cache invalidation.

query()

Pass a generated SDK method call. The cache key and types are inferred automatically from the SDK:
SDK methods return a QueryDescriptor — an object that carries the fetch function, a deterministic cache key, and entity metadata. query() unwraps the Result for you: if the SDK call succeeds, data gets the value; if it fails, error gets the error. See the Generated SDK reference for details on how SDK methods and the Result type work.

Signature


QueryResult

The returned object has reactive properties that auto-update in the DOM — the compiler handles reactivity for you.
refetch() resets data to undefined and shows loading state. revalidate() keeps the current data visible while fetching fresh data in the background (stale-while-revalidate pattern).

QueryOptions


invalidate()

Force all queries with a matching key to refetch.

Signature


SSR support

Queries execute during SSR automatically. The server waits for queries to resolve (up to ssrTimeout), serializes the data, and the client hydrates without re-fetching.

Types