Skip to content

API reference > @kontsedal/olas-react > useSuspenseQuery

useSuspenseQuery() function ​

Suspense-first variant of useQuery. data is always T (the hook suspends until the first success, after which refetches don't re-suspend). Errors throw to the nearest ErrorBoundary **only on the initial load, before any data lands** — a later background-refetch failure keeps the last-good data rendered (the error stays observable via a non-suspense useQuery).

Sugar over useQuery(sub, { suspense: true }); exists so call sites read as useSuspenseQuery(sub) without an options bag.

Signature:

typescript
export declare function useSuspenseQuery<T>(subscription: AsyncState<T>): UseSuspenseQueryResult<T>;

Parameters ​

Parameter

Type

Description

subscription

AsyncState<T>

Returns:

UseSuspenseQueryResult<T>

Released under the MIT License.