Back to Plate

pagination burst typing performance

docs/plans/2026-05-28-pagination-burst-typing-performance.md

53.0.87.1 KB
Original Source

pagination burst typing performance

Objective: Fix virtualized pagination fast typing so burst input in the middle of /examples/pagination preserves every typed character and stays responsive on the real rich-markdown stress document.

Completion threshold:

  • Browser proof types a multi-character string without per-character model-selection waits.
  • The full string appears in the target block and model text.
  • Model selection catches up after the burst.
  • Mounted DOM/page surfaces stay bounded.
  • Focused package/site checks pass.

Verification surface:

  • PLAYWRIGHT_RETRIES=0 bun playwright playwright/integration/examples/pagination.test.ts --project=chromium -g "keeps fast burst typing" --reporter=line
  • PLAYWRIGHT_RETRIES=0 bun playwright playwright/integration/examples/pagination.test.ts --project=chromium -g "keeps middle-document typing responsive" --reporter=line
  • bun test ./packages/slate-react/test/dom-repair-policy-contract.ts
  • cd packages/slate-react && bun test:vitest test/input-router-contract.test.tsx
  • bun --filter slate-react typecheck
  • bun typecheck:site
  • bun lint:fix

Constraints:

  • Preserve the real pagination stress document and virtualized page behavior.
  • No commit, PR, or tracker sync.

Boundaries:

  • Implementation and tests in /Users/zbeyens/git/plate-2/.tmp/slate-v2.
  • Goal plan in /Users/zbeyens/git/plate-2/docs/plans.
  • Browser surface: /examples/pagination, DOM strategy virtualized.

Blocked condition: Stop only if burst typing cannot be reproduced or no code-owned repair path remains. This did not happen.

Start Gates:

GateAppliesEvidence
Skill analysis before editsyesUsed performance and debug; root cause investigation before fix.
Active goal checked or createdyesCreated active goal for virtualized pagination burst typing.
Source of truth read before editsyesUser reported fast typing still slow and skipping chars.
Browser route identifiedyes/examples/pagination with DOM strategy virtualized.
TDD decisionyesAdded failing burst Playwright repro before repair changes.
Release artifact decisionyesExisting pagination typing changeset covers slate-react behavior change.
PR expectationnoN/A: no PR requested.
Tracker syncnoN/A: chat-only report.

Work Checklist:

  • Reproduced burst typing without per-character waits.
  • Identified root cause from evidence.
  • Fixed the owning runtime boundary.
  • Added focused unit coverage for burst DOM delta import.
  • Added focused browser coverage for burst typing.
  • Verified the previous single-character latency proof still passes.
  • Recorded package/site/lint evidence.
  • Recorded remaining caveats.

Completion Gates:

GateAppliesRequired actionEvidence
Bug reproduced before fixyesRun focused burst proofFailed with text Release arcdeeghajklmdopiness memo, proving skipped/reordered chars.
Targeted behavior verificationyesRun burst proof after fixPassed.
Previous latency proofyesRerun existing middle typing proofPassed.
TypeScript changedyesRun relevant typecheckbun --filter slate-react typecheck and bun typecheck:site passed.
LintyesRun formatter/lint fixbun lint:fix passed.
Package behavior changedyesChangesetCovered by existing pagination typing changeset.
PR create or updatenoN/ANo PR requested.

Phase / pass table:

PhaseStatusEvidenceNext
ReproducecompleteBurst Playwright row failed before fix.root cause
Root causecompleteDeferred repair replayed old individual input events against later DOM selection and caret repair fought live typing.implementation
ImplementationcompleteDebounced virtualized native text repair and imported current DOM/model delta once.verification
VerificationcompleteFocused browser/unit/type/site/lint checks passed.closeout
CloseoutcompletePlan recorded.final

Findings:

  • The prior proof waited for model selection after every character, hiding the actual user path.
  • Fast typing produced corrupted text such as Release arcdeeghajklmdopiness memo.
  • Root cause: virtualized deferred repair replayed old single-character input events against later DOM selection, and repeated caret repair interrupted the browser's live selection during a burst.

Performance:

  • applicability: applied.
  • repeated unit: active virtualized text block inside mounted page surfaces.
  • cohorts: stress document, ~1000 pages.
  • budgets: burst proof keeps DOM < 1400 and page surfaces <= 10.
  • interaction metrics: burst string typed with keyboard.type(..., { delay: 0 }).
  • degradation contract: virtualized mode lets native DOM own burst text while model repair debounces briefly, imports the full DOM delta, then catches model selection up.
  • dashboard/RUM gap: no production RUM added.

Implementation notes:

  • input-router debounces deferred native text repair for virtualized insert text bursts and coalesces pending repairs.
  • dom-repair-queue imports the current DOM text delta relative to the Slate text instead of trusting the stale single-character InputEvent.data.
  • Playwright now has a burst typing proof that does not wait per character.

Verification evidence:

  • Failing repro before fix: PLAYWRIGHT_RETRIES=0 bun playwright playwright/integration/examples/pagination.test.ts --project=chromium -g "keeps fast burst typing" --reporter=line failed with missing/reordered chars.
  • Passing proof after fix: PLAYWRIGHT_RETRIES=0 bun playwright playwright/integration/examples/pagination.test.ts --project=chromium -g "keeps fast burst typing" --reporter=line passed.
  • Regression proof: PLAYWRIGHT_RETRIES=0 bun playwright playwright/integration/examples/pagination.test.ts --project=chromium -g "keeps middle-document typing responsive" --reporter=line passed.
  • bun test ./packages/slate-react/test/dom-repair-policy-contract.ts passed.
  • cd packages/slate-react && bun test:vitest test/input-router-contract.test.tsx passed.
  • bun --filter slate-react typecheck passed.
  • bun typecheck:site passed.
  • bun lint:fix passed.

Final handoff contract:

  • PR line: N/A, no PR requested.
  • Issue / tracker line: N/A, chat-only report.
  • Confidence line: high for focused Chromium burst typing in virtualized pagination; mobile/IME remains unproven.
  • Browser check: focused Chromium Playwright proof.
  • Outcome: fast burst typing preserves the full typed string and model selection catches up.
  • Caveat: no full browser matrix, no mobile/IME proof.

Reboot status: Complete. Dev server remains the live manual verification surface.

Open risks:

  • Debounced model repair means model state trails native DOM during an active burst by a short delay; non-insert input flushes pending repair first.
  • Mobile/IME needs separate proof before claiming full parity.

Timeline:

  • 2026-05-28T15:42Z Burst repro added and failed with skipped/reordered chars.
  • 2026-05-28T15:49Z Unit and browser burst proofs passed after repair debounce and DOM delta import.