Deterministic canonical serialization
Guarantees that two grids in the same logical state produce byte-identical serialized output, using sorted keys, normalized numbers, omitted defaults and stable array ordering. Determinism makes state hashable, diffable, cacheable and safe to use in URLs and version control.
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
Two side-by-side grids with the same columns. The user reaches the same layout on each through different interaction orders.
Expected behavior
After reaching the same layout through different steps, both grids show an identical serialized string and hash, and Compare reports 'equal'. Turning off Omit defaults changes the size of the output but keeps the two outputs equal to each other.
Planned API surface
serializeState(state)getStateHash(state)stateEquals(a, b)omitDefaults optionAcceptance criteria
- Object keys are emitted in lexicographic order. (pending)
- Set-like arrays, such as selection ids, are sorted by a documented comparator. Order-significant arrays, such as sort and column order, keep their order. (pending)
- Floating-point widths are rounded to a documented precision. (pending)
- stateEquals ignores volatile fields such as timestamps. (pending)
- getStateHash is stable across browsers and is not cryptographic by default. (pending)