Skip to content
IC Reactor

BaseQueryConfig

Defined in: react/src/types.ts:68

Base configuration for query wrappers (shared between regular and suspense).

  • Omit<QueryObserverOptions<QueryFnData<Service, Method, Transform>, ReactorReturnErr<Service, Method, Transform>, Selected, QueryFnData<Service, Method, Transform>, QueryKey>, "queryFn" | "queryKey">

Service = BaseActor

The actor interface type

Method extends FunctionName<Service> = FunctionName<Service>

The method name on the actor

Transform extends TransformKey = "candid"

The transformation key (identity, display, etc.)

Selected = QueryFnData<Service, Method, Transform>

The type returned after select transformation

functionName: Method

Defined in: react/src/types.ts:84

The method to call on the canister


optional args?: ReactorArgs<Service, Method, Transform>

Defined in: react/src/types.ts:86

Arguments to pass to the method (if any)


optional callConfig?: CallConfig

Defined in: react/src/types.ts:105

Call configuration for the method, as Reactor.callMethod takes it: a canisterId sends the query to another canister of the same interface, an agent sends it through another agent, effectiveCanisterId routes it. The query key carries what it sets, as the hooks’ keys do, so the answer is cached apart from the reactor’s own canister and agent, and getQueryKey(), invalidate() and the other cache controls act on that entry.

// The same ledger interface, another token's canister
const ckbtcSymbol = createQuery(ledger, {
functionName: "icrc1_symbol",
callConfig: { canisterId: "mxzaz-hqaaa-aaaar-qaada-cai" },
})

optional queryKey?: readonly unknown[]

Defined in: react/src/types.ts:107

The query key to use for this query


optional staleTime?: number

Defined in: react/src/types.ts:119

How long data stays fresh before refetching, in milliseconds.

createQuery, createSuspenseQuery and their factories default to 5 minutes. The bound useActorQuery and useActorSuspenseQuery hooks (from createActorHooks or defineReactor) set no default and leave it to TanStack Query, which reads the QueryClient’s defaultOptions.queries.staleTime. With that unset too, useActorQuery uses 0 and useActorSuspenseQuery uses 1 second, TanStack Query’s fallback for suspense queries.

Omit.staleTime


optional select?: (data) => Selected

Defined in: react/src/types.ts:121

Transform the raw result before returning

ReactorQueryData<ReactorReturnOk<Service, Method, Transform>>

Selected

Omit.select