docs/research/decisions/slate-v2-data-model-first-react-perfect-runtime.md
Accept the architecture target:
slate-react runtimeReject both weaker framings:
The core should stop fighting React, but React must not define the core ontology.
The active huge-doc runtime lane is complete under this decision.
Current proof:
slate-react uses an explicit DOM-owned plain text capability for the urgent
active typing lanedecorate callbacks are represented only through the explicitly named
createSlateDecorateCompatSource projection-source adapter; the final public
Editable surface is projection-store firstslate-react product
runtime; legacy chunking remains only in comparison fixturesslate-dom and slate-react build/typecheck are greenRemaining work belongs to broader release claim-width and example parity, not this architecture lane.
Ian's feedback is correct: Slate's durable advantage is the JSON-like document model plus operation layer. That should stay at the top of the principles stack.
The current huge-document perf work also proved that the old runtime shape is not good enough:
Editor.getSnapshot() is too expensive as an urgent render read.So the right move is not to make core React-shaped. The right move is to give renderers better runtime primitives while preserving the model/operation identity of Slate.
Local evidence:
../prosemirror/view/src/decoration.ts../prosemirror/state/src/selection.tsRelevant lessons:
SelectionBookmark is a durable selection value that maps independently and
resolves laterSlate v2 take:
decorate callbackLocal evidence:
../lexical/packages/lexical/src/LexicalUpdates.ts../lexical/packages/lexical/src/LexicalReconciler.ts../lexical/packages/lexical/src/nodes/LexicalDecoratorNode.tsRelevant lessons:
Slate v2 take:
Local evidence:
../vscode/src/vs/editor/common/viewModel/viewModelImpl.ts../vscode/src/vscode-dts/vscode.d.tsRelevant lessons:
Slate v2 take:
Local evidence:
../pretext/README.md../premirror/README.mdRelevant lessons:
Slate v2 take:
Local evidence:
../db/README.md../db/packages/react-db/src/useLiveQuery.tsRelevant lessons:
Slate v2 take:
Local evidence:
../edit-context/dev-design.mdRelevant lessons:
Slate v2 take:
Owns:
Does not own:
Owns hot read APIs:
These APIs are data-model/runtime APIs, not React APIs.
Owns immutable snapshots for:
Not allowed:
Owns direct text DOM sync only when it is explicitly safe:
Everything else falls back to React rendering.
Owns:
Owns inactive region activation.
Activation must be separate from selection unless the user action intentionally publishes a visible selection operation.
Editor.getSnapshot() as the urgent hot read path.slate React-first.| Corpus | Files inspected | Strongest evidence | Disposition |
|---|---|---|---|
| ProseMirror | view/src/decoration.ts, state/src/selection.ts | mapped decorations, widget side/selection specs, selection bookmarks | evidenced |
| Lexical | LexicalUpdates.ts, LexicalReconciler.ts, LexicalDecoratorNode.ts | dirty leaves/elements, explicit reconcile, decorator lane | evidenced |
| VS Code | viewModelImpl.ts, vscode.d.ts grep/read | text model vs view model, typed decoration/widget/comment surfaces | evidenced |
| Pretext / Premirror | README.md files | derived measurement/layout lane over document truth | evidenced |
| TanStack DB | README.md, useLiveQuery.ts | normalized live store plus React subscription posture | evidenced |
| EditContext | dev-design.md | text/selection/layout/IME responsibilities split by platform | evidenced |
| Slate v2 | current slate, slate-react, perf plan/context | proof that corridor + direct text lane wins measured huge-doc lanes | evidenced, with correctness hardening required |
The performance architecture can be excellent, but only after the fast path is made explicit and safe.
The next implementation should harden:
Until those are done, the perf win is real but the editing/accessibility story is not strong enough to call "perfect".