API reference · generated from source
Function: createFetchQuerySource()#
function createFetchQuerySource<TArgs, TState>(fetchFn, options?): IQuerySubscriptionSource<TArgs, TState>;Defined in: retree-query/src/fetchQueryNode.ts:113
Adapt an async function into an IQuerySubscriptionSource.
Type Parameters#
| Type Parameter |
|---|
TArgs |
TState |
Parameters#
| Parameter | Type | Description |
|---|---|---|
fetchFn | (args, context) => Promise<TState> | Async function receiving query args and an abort signal context. |
options? | IFetchQuerySourceOptions | Optional polling configuration. |
Returns#
IQuerySubscriptionSource<TArgs, TState>
A subscription source usable with QueryNode.
Remarks#
Each subscription runs the fetch function once immediately and, when
refetchInterval is set, again on interval ticks. Ticks during an active
request are skipped, so requests never overlap within a subscription.
Closing the subscription aborts its signal and drops late results/errors.