State change events with source and diff
Emits a single, batched stateChange event whenever persisted state changes. The event reports which slices changed, a structural diff, and whether the change came from a user, the API, a restore or a migration. This is the hook that auto-save, analytics and URL sync build on.
Planned. This page shows the specification from issue #201. The live example, source for every framework and the API reference replace it when the feature ships.
Live example
A grid with an event log panel that shows the newest event first.
Expected behavior
Resizing a column produces one event, emitted at the end of the drag, with source 'user' and changedSlices ['columns']. Calling setState produces an event with source 'restore', or no event when suppression is on.
Planned API surface
onStateChangeStateChangeEvent.changedSlicesStateChangeEvent.diffStateChangeEvent.sourcesuppressEvents option on setStateAcceptance criteria
- Continuous interactions such as dragging or resizing emit one event when the interaction ends, not one per frame. (pending)
- Multiple changes made in the same task are coalesced into one event. (pending)
- The diff uses JSON-Patch-style operations relative to the previous canonical state. (pending)
- source is one of 'user', 'api', 'restore', 'migration' or 'data'. (pending)
- Scroll changes are excluded by default and can be enabled with includeScrollInEvents. (pending)