Skip to content

Stabilize project grouping settings selector#2629

Draft
cursor[bot] wants to merge 2 commits intomainfrom
cursor/react-performance-optimization-535a
Draft

Stabilize project grouping settings selector#2629
cursor[bot] wants to merge 2 commits intomainfrom
cursor/react-performance-optimization-535a

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor Bot commented May 10, 2026

What Changed

  • Added a shared selectProjectGroupingSettings selector in logicalProject.ts.
  • Replaced repeated inline project-grouping settings selectors in Sidebar, ChatView, root event routing, and new-thread creation with the stable selector.
  • Added React Scan before/after recordings under artifacts/react-performance/:
    • before-react-scan-project-grouping.webm
    • after-react-scan-project-grouping.webm

Why

Inline object selectors were creating a new selector function on every render. When large parents like Sidebar or ChatView re-rendered for unrelated state, useSettings recomputed a fresh project grouping object, invalidating downstream memoized project grouping/environment derivations and increasing rerender work. A module-level selector keeps the selector identity stable and lets unrelated parent renders reuse the same selected grouping object.

React Doctor was run for a full scan and a diff scan. The remaining diff findings are pre-existing large-component/effect/loop diagnostics in Sidebar/ChatView; the new helper and new-thread call site have no React Doctor diagnostics.

UI Changes

No intentional UI behavior change. React Scan recordings with the same authenticated navigation flow are committed in artifacts/react-performance/:

  • Before: artifacts/react-performance/before-react-scan-project-grouping.webm
  • After: artifacts/react-performance/after-react-scan-project-grouping.webm

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:

  • bun fmt
  • bun lint (passes with existing warnings)
  • bun typecheck
  • npx -y react-doctor@latest . --json --offline --fail-on none
  • npx -y react-doctor@latest . --diff main --json --offline --fail-on none
Open in Web View Automation 

Note

Stabilize project grouping settings selector to prevent unnecessary re-renders

Extracts a shared selectProjectGroupingSettings selector function in logicalProject.ts and replaces inline object selectors in ChatView, Sidebar, useHandleNewThread, and EventRouter. Inline selectors construct a new object on every render, causing unnecessary re-renders in components that use useSettings; a stable shared selector avoids this.

Macroscope summarized bfc6cd8.

cursoragent and others added 2 commits May 10, 2026 16:16
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant