API reference · generated from source
Function: createFetchQuerySource()#
function createFetchQuerySource<TArgs, TState>(fetchFn, options?): IQuerySubscriptionSource<TArgs, TState>;Defined in: retree-query/src/fetchQueryNode.ts:106
Adapt an async function into an IQuerySubscriptionSource.
Type Parameters#
| Type Parameter |
|---|
TArgs |
TState |
Parameters#
| Parameter | Type | Description |
|---|---|---|
fetchFn | (args) => Promise<TState> | Async function producing a query value for the given args. |
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 every interval tick. Results and errors
that resolve after the subscription is closed are dropped.