API reference · generated from source
Interface: IStateReconciler<TState>#
Defined in: retree-query/bin/types.d.ts:86
Reconciles an incoming query value against the current node state.
Type Parameters#
| Type Parameter |
|---|
TState |
Methods#
reconcile()#
reconcile(
current,
next,
rawCurrent?): TState;Defined in: retree-query/bin/types.d.ts:109
Reconcile next into current.
Parameters#
| Parameter | Type | Description |
|---|---|---|
current | TState | undefined | Current query state, if any. Write surface. |
next | TState | Newly emitted query state (raw server data). |
rawCurrent? | TState | Raw view of current for fast reads; undefined when current is undefined or not object-valued. |
Returns#
TState
The state object that should be assigned to the query node.
Remarks#
Reconciliation is read-dominated: it compares every field and writes
only the diffs. Read from rawCurrent, write to current.
rawCurrent is the raw object behind current (Retree.raw) —
native-speed, proxy-free reads. Writes must go through current so
changed rows emit nodeChanged and item identity stays stable for
useNode rows; writes to rawCurrent skip emission entirely.
next may be shared with other queries and the source's cache, so
never write its objects into current directly. reconcileArray
copies what it writes, and a returned replacement value is copied
except for rows it reuses from current.