createSuspenseInfiniteQueryFactory
createSuspenseInfiniteQueryFactory<
Service,Transform,Method,TPageParam,Selected>(reactor,config):SuspenseInfiniteQueryFactoryFn<Service,Method,Transform,TPageParam,Selected>
Defined in: react/src/createSuspenseInfiniteQuery.ts:531
Create a suspense infinite query factory that accepts getArgs at call time. Useful when pagination logic varies by context.
Type Parameters
Section titled “Type Parameters”Service
Section titled “Service”Service
The actor interface type
Transform
Section titled “Transform”Transform extends keyof TransformArgsRegistry<unknown>
The transformation key (identity, display, etc.)
Method
Section titled “Method”Method extends string = FunctionName<Service>
The method name on the actor
TPageParam
Section titled “TPageParam”TPageParam = unknown
The page parameter type
Selected
Section titled “Selected”Selected = InfiniteData<ReactorQueryData<ReactorReturnOk<Service, Method, Transform>>, TPageParam>
The type returned after select transformation
Parameters
Section titled “Parameters”reactor
Section titled “reactor”Reactor<Service, Transform>
The Reactor instance
config
Section titled “config”SuspenseInfiniteQueryFactoryConfig<NoInfer<Service>, Method, Transform, TPageParam, Selected>
Suspense infinite query configuration (without getArgs)
Returns
Section titled “Returns”SuspenseInfiniteQueryFactoryFn<Service, Method, Transform, TPageParam, Selected>
A function that accepts getArgs and returns an SuspenseActorInfiniteQueryResult
Example
Section titled “Example”const getPostsQuery = createActorSuspenseInfiniteQueryFactory(reactor, { functionName: "get_posts", initialPageParam: 0, getKeyArgs: (args) => { const [{ userId }] = args return [{ userId }] }, getNextPageParam: (lastPage) => lastPage.nextCursor,})
// Create query with specific args builderconst userPostsQuery = getPostsQuery((cursor) => [{ userId, cursor, limit: 10 }])const { data, fetchNextPage } = userPostsQuery.useSuspenseInfiniteQuery()
// Optional: append a manual query-key suffix in addition to auto key argsconst scopedPostsQuery = getPostsQuery( (cursor) => [{ userId, cursor, limit: 10 }], { queryKey: ["v2"] })