API reference · generated from source
Interface: IOptimisticQueryTransform<TState>#
Defined in: retree-query/src/types.ts:73
Imperative optimistic state transform for a QueryNode.
Type Parameters#
| Type Parameter |
|---|
TState |
Properties#
| Property | Type | Description | Defined in |
|---|---|---|---|
ctx? | IOptimisticUpdateContext<unknown> | Optional mutation context. When provided, the node rolls this optimistic state back if the promise rejects before a newer server value resolves the dirty state. | retree-query/src/types.ts:79 |
revert? | (state, snapshot) => void | Optional custom rollback. When omitted, the node restores the latest clean server baseline at rejection time — including any server confirmations that arrived after IOptimisticQueryTransform.apply ran, so a failed mutation never wipes a confirmed one. | retree-query/src/types.ts:90 |
Methods#
apply()#
apply(state): void;Defined in: retree-query/src/types.ts:83
Apply an optimistic change to the current query state.
Parameters#
| Parameter | Type |
|---|---|
state | TState |
Returns#
void