@somnia-chain/markets-sdk / react / useIndexerQuery
Function: useIndexerQuery()
useIndexerQuery<
T>(fn,deps):IndexerQueryState<T>
Defined in: packages/sdk/src/hooks.ts:299
Run an async indexer read against the context client, re-running when deps
change. Errors are captured (not thrown) so a failed indexer read renders as
error, not a crash. A superseded request (deps changed, refetch, unmount)
is aborted via the signal handed to fn, and its response is discarded
either way. Client reads take no per-request signal (cancellation is
client-scoped, via ClientConfig.signal), so the signal matters when fn
does its own fetching — pass it to anything that accepts one.
ts
const { data: markets } = useIndexerQuery((c) => c.listBinaryMarkets({ limit: 20 }), []);
Type Parameters
T
T
Parameters
fn
(client, signal) => Promise<T>
deps
readonly unknown[]