API reference · generated from source
Function: reconcileArrayById()#
function reconcileArrayById<TItem, TKey>(idKey): IStateReconciler<TItem[]>;Defined in: retree-convex/src/reconcile.ts:31
Create a reconciler for arrays of objects with stable IDs.
Type Parameters#
| Type Parameter |
|---|
TItem extends Record<TKey, PropertyKey> |
TKey extends string |
Parameters#
| Parameter | Type | Description |
|---|---|---|
idKey | TKey | Object key containing the stable item ID. |
Returns#
IStateReconciler<TItem[]>
A reconciler that updates matching array items in place.
Remarks#
Use this for non-Convex arrays whose items have stable IDs. Reconciliation
updates matching items in place so child object identity stays stable for
useNode(item) rows and Retree parent relationships.
Do not use index-based reconciliation for lists that can reorder. Prefer a stable ID from the server.
Example#
this.tasks = this.query(api.tasks.listExternal, {
args: { projectId },
reconcile: reconcileArrayById("id"),
});