[]previous and next page

ReconcileOptions

Options of reconcile.

Options of reconcile.

Import#

ts
import type { ReconcileOptions } from "@shadow-js/core";

Signature#

ts
interface ReconcileOptions {
  /**
   * Identity of array items: the name of a field (`"id"`) or a function returning the identity.
   * Items without an identity (not an object, or the field is absent, or the function returns
   * `undefined`) are matched by position.
   * @default "id"
   */
  key?: string | ((item: unknown) => unknown);
  /**
   * Keep keys, and array items, that `next` does not contain. When false, keys missing from `next`
   * are deleted and arrays are truncated to its length; when true, unmatched old array items are
   * kept after the new ones.
   * @default false
   */
  merge?: boolean;
}

Members#

Name Type Description
key? key?: string | ((item: unknown) => unknown) Identity of array items: the name of a field ("id") or a function returning the identity. Items without an identity (not an object, or the field is absent, or the function returns undefined) are matched by position.
merge? merge?: boolean Keep keys, and array items, that next does not contain. When false, keys missing from next are deleted and arrays are truncated to its length; when true, unmatched old array items are kept after the new ones.