Skip to content

Stabilize composer model picker rerenders#3602

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/component-performance-optimization-89ef
Draft

Stabilize composer model picker rerenders#3602
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/component-performance-optimization-89ef

Conversation

@cursor

@cursor cursor Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

What Changed

  • Stabilized the ChatComposer -> ProviderModelPicker onOpenChange callback with useCallback.
  • Keeps the memoized provider/model picker from receiving a fresh inline function on every composer prompt render.

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 showed ProviderModelPicker increasing with every composer keystroke (20 -> 31). After this change, the same recording kept ProviderModelPicker flat at 5 while the actual editor components continued to update.

React Scan recordings included:

  • Before: react_scan_provider_picker_before.mp4
  • After: react_scan_provider_picker_after.mp4

UI Changes

No visual UI changes. This is a render-performance fix demonstrated with React Scan before/after recordings.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Validation:

  • npx react-doctor@latest apps/web --verbose --no-telemetry (scan completed; existing backlog reported)
  • npx react-scan@latest --help (CLI checked; this environment exposes init, so recordings used React Scan browser instrumentation)
  • vp check
  • vp run typecheck
Open in Web View Automation 

Note

Stabilize model picker onOpenChange callback in ChatComposer

Wraps the inline onOpenChange function passed to the model picker in useCallback so it has a stable reference across renders. State update behavior is unchanged.

Macroscope summarized 2bda93b.

Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
@github-actions github-actions Bot added size:XS 0-9 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

1 participant