Skip to content
IC Reactor

SkippableInfiniteQueryConfig

Defined in: react/src/createInfiniteQuery.ts:198

Configuration for the non-suspense infinite query hook of createActorHooks and defineReactor (useActorInfiniteQuery): an InfiniteQueryConfig whose getArgs may also be TanStack Query’s skipToken, for a list whose arguments are not known yet.

A skipped list does not fetch. It has an entry of its own under its method and config queryKey (at the canister and agent callConfig names), which no call’s key shares, so it shows no data until the arguments arrive. Once getArgs is a function, the list is keyed and fetched as usual. Its refetch() has nothing to run: TanStack Query answers it with a “Missing queryFn” error. useActorSuspenseInfiniteQuery does not take skipToken.

import { skipToken } from "@ic-reactor/react"
const { data } = useActorInfiniteQuery({
functionName: "get_transactions",
getArgs: account
? (start: bigint) => [{ account, start, length: 20n }]
: skipToken,
initialPageParam: 0n,
getNextPageParam: (lastPage) => lastPage.next[0],
})

Service = BaseActor

Method extends FunctionName<Service> = FunctionName<Service>

Transform extends TransformKey = "candid"

TPageParam = unknown

Selected = InfiniteData<InfiniteQueryPageData<Service, Method, Transform>, TPageParam>

functionName: Method

Defined in: react/src/createInfiniteQuery.ts:136

The method to call on the canister

Omit.functionName


optional callConfig?: CallConfig

Defined in: react/src/createInfiniteQuery.ts:138

Call configuration for the actor method

Omit.callConfig


optional queryKey?: readonly unknown[]

Defined in: react/src/createInfiniteQuery.ts:140

Custom query key (optional, auto-generated if not provided)

Omit.queryKey


initialPageParam: TPageParam

Defined in: react/src/createInfiniteQuery.ts:142

Initial page parameter

Omit.initialPageParam


optional getKeyArgs?: (args) => unknown

Defined in: react/src/createInfiniteQuery.ts:154

Narrows what the cache key derives from the call arguments.

By default the key is scoped by getArgs(initialPageParam), so two infinite queries on the same method with different arguments stay in separate cache entries. Supply this when those args embed the cursor and only part of them identifies the query — return the stable, serializable portion (typically everything except the pagination field).

ReactorArgs<Service, Method, Transform>

unknown

Omit.getKeyArgs


getNextPageParam: (lastPage, allPages, lastPageParam, allPageParams) => TPageParam | null | undefined

Defined in: react/src/createInfiniteQuery.ts:156

Function to determine next page parameter

ReactorQueryData<ReactorReturnOk<Service, Method, Transform>>

ReactorQueryData<ReactorReturnOk<Service, Method, Transform>>[]

TPageParam

TPageParam[]

TPageParam | null | undefined

Omit.getNextPageParam


optional getPreviousPageParam?: (firstPage, allPages, firstPageParam, allPageParams) => TPageParam | null | undefined

Defined in: react/src/createInfiniteQuery.ts:163

Function to determine previous page parameter (for bi-directional)

ReactorQueryData<ReactorReturnOk<Service, Method, Transform>>

ReactorQueryData<ReactorReturnOk<Service, Method, Transform>>[]

TPageParam

TPageParam[]

TPageParam | null | undefined

Omit.getPreviousPageParam


getArgs: typeof skipToken | ((pageParam) => ReactorArgs<Service, Method, Transform>)

Defined in: react/src/createInfiniteQuery.ts:215

Function to get args from page parameter, or skipToken while the args are not known: the list then waits without fetching.