Skip to content

Optimize settings sidebar nav rerenders#2792

Draft
cursor[bot] wants to merge 5 commits into
mainfrom
cursor/react-component-health-33b8
Draft

Optimize settings sidebar nav rerenders#2792
cursor[bot] wants to merge 5 commits into
mainfrom
cursor/react-component-health-33b8

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor Bot commented May 23, 2026

What Changed

  • Split settings sidebar nav item metadata into a non-component module.
  • Extracted each settings sidebar row into a memoized SettingsSidebarNavItem component with a stable selection callback.
  • Added React Scan before/after recordings and render-count artifacts:
    • docs/react-scan/settings-sidebar-nav/before.webm
    • docs/react-scan/settings-sidebar-nav/after.webm
    • docs/react-scan/settings-sidebar-nav/before-counts.json
    • docs/react-scan/settings-sidebar-nav/after-counts.json

Why

React Doctor plus a manual React Scan pass showed the Settings navigation rerendering every sidebar menu row during settings route changes. For the same interaction path (Settings -> Keybindings -> Providers -> Source Control -> General), React Scan render logs changed from:

  • SidebarMenuItem: 37 before -> 16 after
  • SidebarMenuButton: 37 before -> 16 after

Unaffected settings rows now remain memoized while the active row changes.

UI Changes

Interaction recordings with React Scan enabled are committed in:

  • Before: docs/react-scan/settings-sidebar-nav/before.webm
  • After: docs/react-scan/settings-sidebar-nav/after.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:

  • react-doctor scan after fix: no SettingsSidebarNav diagnostics
  • bun fmt
  • bun lint
  • bun typecheck
Open in Web View Automation 

Note

Reduce rerenders in settings sidebar nav by extracting SettingsSidebarNavItem

  • Extracts nav item data (types, constants) into SettingsSidebarNav.items.ts to keep it stable across renders.
  • Adds a memoized SettingsSidebarNavItem component that uses useCallback for its select handler, preventing unnecessary child rerenders.
  • Behavioral Change: the Back button padding changes from px-2 py-2 to p-2, which is visually equivalent but uses a different Tailwind class.

Macroscope summarized 654f876.

cursoragent and others added 5 commits May 23, 2026 16:26
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
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 size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 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