BaseQueryConfig
Defined in: react/src/types.ts:68
Base configuration for query wrappers (shared between regular and suspense).
Extends
Section titled “Extends”Omit<QueryObserverOptions<QueryFnData<Service,Method,Transform>,ReactorReturnErr<Service,Method,Transform>,Selected,QueryFnData<Service,Method,Transform>,QueryKey>,"queryFn"|"queryKey">
Type Parameters
Section titled “Type Parameters”Service
Section titled “Service”Service = BaseActor
The actor interface type
Method
Section titled “Method”Method extends FunctionName<Service> = FunctionName<Service>
The method name on the actor
Transform
Section titled “Transform”Transform extends TransformKey = "candid"
The transformation key (identity, display, etc.)
Selected
Section titled “Selected”Selected = QueryFnData<Service, Method, Transform>
The type returned after select transformation
Properties
Section titled “Properties”functionName
Section titled “functionName”functionName:
Method
Defined in: react/src/types.ts:84
The method to call on the canister
optionalargs?:ReactorArgs<Service,Method,Transform>
Defined in: react/src/types.ts:86
Arguments to pass to the method (if any)
callConfig?
Section titled “callConfig?”
optionalcallConfig?: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.
Example
Section titled “Example”// The same ledger interface, another token's canisterconst ckbtcSymbol = createQuery(ledger, { functionName: "icrc1_symbol", callConfig: { canisterId: "mxzaz-hqaaa-aaaar-qaada-cai" },})queryKey?
Section titled “queryKey?”
optionalqueryKey?: readonlyunknown[]
Defined in: react/src/types.ts:107
The query key to use for this query
staleTime?
Section titled “staleTime?”
optionalstaleTime?: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.
Overrides
Section titled “Overrides”Omit.staleTime
select?
Section titled “select?”
optionalselect?: (data) =>Selected
Defined in: react/src/types.ts:121
Transform the raw result before returning
Parameters
Section titled “Parameters”ReactorQueryData<ReactorReturnOk<Service, Method, Transform>>
Returns
Section titled “Returns”Selected
Overrides
Section titled “Overrides”Omit.select