Repository navigation
Avoid timeline rerenders while typing in prompt boxes - #1799
Merged
ymichael merged 2 commits intoAug 18, 2026
Merged
Conversation
Draft writes changed the promptDraft object identity, which recreated the embedded timeline's add-to-chat callback on every keystroke. That invalidated ThreadTimelineRows' static renderer context and rerendered all visible rows. Depend on the stable addQuote setter instead, and avoid the prompt's custom caret layout measurement for native typing transactions.
ymichael
force-pushed
the
agent/fix-composer-typing-performance
branch
from
August 18, 2026 19:38
fae350e to
2b95ae5
Compare
ymichael
marked this pull request as ready for review
August 18, 2026 19:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ThreadDetailViewInternalfrom subscribing to per-keystroke draft writes when it only needs imperativeaddQuoteandstorageKeyactionscoordsAtPoscaret measurement for ordinary native typing while retaining it for selection-only, clipboard, and drop updatesuiEventmetadata as ProseMirror's default paste pathFixes #1304.
Root cause
The original PR addressed two genuine local costs, but issue #1304's broader scaling path remained:
ThreadDetailViewInternalsubscribed tousePromptDraftStorageonly for stable draft actions. Every keystroke therefore re-rendered the whole thread view. Each render also rebuilt an equalOpenInTargetContext; identity-keyed memoization recreatedopenPathInFileTarget, then theMarkdownLocalFileContextMenuContext.Providervalue around the mounted timeline, forcing React to scan that subtree for consumers.The thread view now uses the non-subscribing draft accessor, whose quote action shares the hook's existing implementation.
useLocalOpenTargetskeys its context memo onkind,hostId, andserverOrigin, preserving callback identity for semantically equal contexts without keeping stale remote context fields.Verification
pnpm exec turbo run typecheck --filter=@bb/apppnpm exec turbo run lint --filter=@bb/app(0 errors; repository baseline of 147 warnings)pnpm exec turbo run test --filter=@bb/app --force: 363 files / 2,870 tests passedgit diff --check