OptionalclassOptionalclassOptionalexternalControlled mode: pass an external diff result (e.g. from a parent EntityApproval that owns the hook). When provided, the component's internal useEntityDiff hook is still created (hooks rules require unconditional calls) but rendering uses the controlled diff.
OptionalformatCustom value formatter; defaults to JSON.stringify.
OptionalincludeIf true, include unchanged fields in the result (default: false).
OptionalrenderCustom renderer for a single field diff row.
OptionalshowWhether to show control buttons (capture/recompute/restore). Default: true
use-entity-diff.ts — Compute field-level diffs between entity graph states.
Reuses core time-travel primitives:
This hook does NOT write to the store during diff computation. It reads two states (a "before" snapshot and the current live graph) and computes a declarative FieldDiff[] — the rendering is left to EntityDiff / EntityApproval.
Hook→Store: reads via useGraphStore.getState() (not via React subscribe) so diff snapshots are point-in-time and do not cause continuous re-renders.