docs/plans/2026-04-11-slate-v2-proof-first-large-document-layer-plan.md
Build a real large-document runtime layer for slate-react that improves
10000-block behavior without regressing the current baseline on normal docs
or broad document operations.
This is the corrected follow-up to the rejected first semantic-islands attempt.
The rejected prototype proved one thing clearly:
Why it failed:
Ctrl+A, paste) fell back into expensive whole-tree workThe next attempt has to be more honest:
Pretext remains planning-only, not active-editing truth.Keep the first version intentionally narrow:
Do not infer sections from headings yet.
The key correction is this:
The shell must still expose useful DOM:
The shell must not mount:
EditableDescendantNodeEditableTextThat is the real win. Everything else is theater.
The previous version died here. So this gets its own contract.
Ctrl+AWhen the large-document layer is active:
Ctrl+A / Cmd+AWhen the current model selection is full-doc or intersects shell-backed ranges:
flushSync into the full treeWhen a user clicks, drags, or keyboards into a far island:
This is the only synchronous promotion path that should exist.
Before the next code attempt, rerun and store:
pnpm bench:replacement:huge-document:localREPLACEMENT_HUGE_BLOCKS=5000 REPLACEMENT_BENCH_ITERATIONS=3 pnpm bench:replacement:huge-document:chunking:compare:localREPLACEMENT_HUGE_BLOCKS=10000 REPLACEMENT_BENCH_ITERATIONS=3 pnpm bench:replacement:huge-document:chunking:compare:localpnpm bench:react:rerender-breadth:localDo not build on stale artifacts.
Deliver:
Files:
packages/slate-react/src/large-document/create-island-plan.tspackages/slate-react/src/large-document/classify-island-kind.tspackages/slate-react/src/large-document/island-shell.tsxpackages/slate-react/src/components/editable-text-blocks.tsxAcceptance:
Deliver:
Files:
packages/slate-react/src/components/editable.tsxpackages/slate-react/src/plugin/react-editor.tspackages/slate-react/src/large-document/use-active-corridor.tspackages/slate-react/src/large-document/promote-island.tsAcceptance:
#4141 breadth does not regressDeliver:
Files:
packages/slate-react/src/components/editable.tsxpackages/slate-react/src/large-document/large-document-commands.tsAcceptance:
10000 select-all and paste do not regress versus current baselineDeliver:
This includes:
Acceptance:
Only if Phase 1-4 still leave a big gap.
Allowed:
Not allowed:
Add focused tests for:
Ctrl+A sets full-doc model selection without expanding all islands#3656 and #4141 stay greenKeep:
pnpm bench:replacement:huge-document:localpnpm bench:replacement:huge-document:chunking:compare:localpnpm bench:react:rerender-breadth:localAdd:
pnpm bench:replacement:huge-document:islands:localThat lane should measure:
The next attempt is worth keeping only if all of these are true:
1000 gate stays green5000 typing stays at or better than the current baseline5000 select-all and paste do not regress10000 select-all and paste do not regress10000 typing improves materially or the ready bill drops materially#3656 and #4141 breadth stay greenIf broad ops regress again:
EditableBlocks until the bars above are metCore likely touchpoints:
New internal module area:
packages/slate-react/src/large-document/Do not retry the old grouped-wrapper idea.
The next robust attempt should start with a hard mechanical constraint:
That is the shortest path toward a large-document layer that might actually beat the current baseline instead of just looking architectural.