docs/solutions/best-practices/2026-05-09-lexical-history-harvest-rows-need-stack-law-contracts.md
LexicalHistory tests are useful, but only after stripping away Lexical command notifications, shared parent editors, node keys, React harness setup, and nested editor extension wiring.
The portable behavior is the history stack law: what enters undo, what enters redo, what clears redo, and which document/selection state comes back.
LexicalHistory in sequence: change, undo, redo, undo, change
looked like a CAN_UNDO/CAN_REDO command test, but the portable row was redo
invalidation after a new edit.Translate each LexicalHistory row to the narrow Slate history contract it actually exercises.
The accepted rows landed in
packages/slate-history/test/history-contract.ts:
The rejected rows stayed out:
History portability lives at the stack and committed-state level, not at the source framework's command surface.
Slate can share the same behavior without sharing Lexical APIs:
slate-history package contracts unless the behavior
needs browser/native transport.