Stabilize composer model picker rerenders#3602
Draft
cursor[bot] wants to merge 1 commit into
Draft
Conversation
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
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.
What Changed
ChatComposer->ProviderModelPickeronOpenChangecallback withuseCallback.Why
React Doctor found broad React Compiler/performance backlog in
apps/web, and a manual hot-path pass found the composer footer model picker rerendering during prompt-only typing. React Scan baseline recording showedProviderModelPickerincreasing with every composer keystroke (20 -> 31). After this change, the same recording keptProviderModelPickerflat at 5 while the actual editor components continued to update.React Scan recordings included:
react_scan_provider_picker_before.mp4react_scan_provider_picker_after.mp4UI Changes
No visual UI changes. This is a render-performance fix demonstrated with React Scan before/after recordings.
Checklist
Validation:
npx react-doctor@latest apps/web --verbose --no-telemetry(scan completed; existing backlog reported)npx react-scan@latest --help(CLI checked; this environment exposesinit, so recordings used React Scan browser instrumentation)vp checkvp run typecheckNote
Stabilize model picker
onOpenChangecallback inChatComposerWraps the inline
onOpenChangefunction passed to the model picker inuseCallbackso it has a stable reference across renders. State update behavior is unchanged.Macroscope summarized 2bda93b.