Repository navigation
Conversation
The mounted editor ignores the content option, yet each controlled value change rebuilt it with buildDocJson. Build it in onBeforeCreate, which runs once per editor instance with the latest text and skills. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Draft parsing moves to editor creation instead of repeating during composer renders. The change is limited to client-side initialization, with existing controlled draft updates unchanged. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Initialize editor document content apps/web/src/components/ComposerPromptEditorTiptap.tsx, apps/web/src/components/ComposerPromptEditorTiptap.input.browser.test.tsx |
The editor builds its initial document in onBeforeCreate using the existing inputs. The browser test checks that buildDocJson runs at creation and replacement, not during text edits, and receives updated text and skills. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Refactor
Suggested reviewers: tris203, juliusmarminge
Merge Risk: 
Minimal · up to 4c530
-
The editor initialization change is consistent with the Tiptap lifecycle and no actionable merge risk remains.
Pre-merge checks: 
4
-
Full details: Title check
-
Explanation
The title names the main change: the composer no longer re-parses the whole draft on each keystroke. The PR moves buildDocJson from the useEditor content option to onBeforeCreate, which matches the title. The title follows the conventional commit format and is specific.
Full details: Description check
-
Explanation
The description follows the template sections: Problem, Change, Scope and approval, and Verification. The Problem section states the wasted parse work. The Change section explains the move to onBeforeCreate and why the mounted editor ignores content. The Scope section cites the small, focused fix exception and explains why it qualifies. The Verification section gives focused test results, a before/after benchmark table, and stated limits, including what was not checked. The description also links related PRs and notes the adversarial review and tooling. The template's optional closing line about the agent model is present. The description is thorough and mostly complete.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
|
Note Written by Verified in a real dev environmentVerified as-is at
The recording is embedded as an animated GIF because GitHub filters externally hosted video. The MP4 was played through and seeking checked in Chrome. Not verifiedNative Electron, iOS and Android clients; macOS/Windows; remote/relay/tunnel connections; other providers; production-build keystroke latency. This VM exercised the Linux web client with Codex. Mobile uses a separate editor. Skill reconciliation and editor recreation were covered by the existing browser test, not a live installed-skill scenario. |
|
Closing this myself. After measuring, the saving is too small for users to notice, so it isn't worth a reviewer's time. Thanks to anyone who looked at it. |



Problem
Each keystroke in the web composer re-parses the whole draft to build an initial document. The mounted editor never uses that document. The wasted work grows with draft length and token count.
Change
ComposerPromptEditorTiptappassedbuildDocJson(value, ...)as theuseEditorcontentoption on every changed value. Tiptap only readscontentwhen it creates an instance. The parse now runs inonBeforeCreate, whichuseEditorforwards to the latest render's options, so a recreated editor still gets current text, mode and skills.The controlled
setContentpath, skill reconciliation, selection, focus, history and editor keys are unchanged. Desktop gets this through web. Mobile has its own editor, and providers are not involved. I added no cache and did not freeze first-render content.Related: #22437 and #28071 also edit
ComposerPromptEditorTiptap.tsx, so whichever lands second may need a rebase.Scope and approval
This qualifies for the small, focused fix exception in CONTRIBUTING.md. It changes no feature, product default, or contract.
Verification
vp test runon the input and citation browser tests pluscomposer-rich-text-doc.test.ts: 273 passed.vp run check:changedpassed.parses the draft only when an editor is created, using the latest text and skillsfails without the fix. Mount plus three typed changes made 4buildDocJsoncalls before and 1 after. Recreating the editor through a hiddenActivityadds one parse with the latest text and skills. A frozen-content variant fails this test.Benchmark: mounted composer in Vitest Chromium with a dev React build and a controlled parent. It times one inserted character through
actand commit. 10 alternating rounds per side. Values are the median of per-round means, with the range across rounds. The script is not committed.The 11- and 479-character ranges overlap, so treat them as ties. Mount time also ties: median 3.00 vs 3.05 ms at 11 chars, 290 vs 274 ms at 26,999 chars, with overlapping ranges. The large mixed draft still costs about 92 ms per edit, and this change does not address that.
An adversarial review found no regression, based on the Tiptap source and the focused test. It did not cover mounted StrictMode, initial update emissions, or undo history by test, and neither did I. I did not measure production-build keystroke latency, or run this in a real client.
Related: #29008 changes inline skill lookups in
packages/shared. It does not overlap.Adversarial review by GPT-6.1 Terra via Codex in T3 Code.
Made with Claude Opus 5.5 via Claude Code in T3 Code.
🤖 Generated with Claude Code