Skip to content

Optimize sidebar PR status rerenders#2862

Draft
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/component-performance-optimization-974f
Draft

Optimize sidebar PR status rerenders#2862
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/component-performance-optimization-974f

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor Bot commented May 29, 2026

What Changed

  • Moved sidebar thread PR/git-status lookup into a small SidebarThreadPrStatusButton child component.
  • Removed project cwd plumbing through SidebarProjectThreadList and SidebarThreadRow, so git target updates do not invalidate the whole thread row.
  • Added React Scan before/after recordings to the branch:
    • react-scan-recordings/before-sidebar-git-status.webm
    • react-scan-recordings/after-sidebar-git-status.webm

Why

React Doctor and a manual pass identified apps/web/src/components/Sidebar.tsx as a hot path. Each branch thread row owned git-status/project-cwd subscription state, so git target/status changes could rerender the full row. Keeping that subscription in the tiny PR-status child limits the rerender surface to the indicator area.

React Scan was enabled during the recordings. The before recording shows SidebarThreadRow highlights during isolated git-target cwd updates; the after recording shows the same updates no longer highlighting the full rows.

UI Changes

No intended visual UI change.

Before/after React Scan recordings are committed in this PR:

  • Before: react-scan-recordings/before-sidebar-git-status.webm
  • After: react-scan-recordings/after-sidebar-git-status.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

Verification:

  • npx -y react-doctor@latest apps/web --json --offline --fail-on none (initial full scan: score 46/Critical; hot files included Sidebar.tsx, ChatView.tsx, CommandPalette.tsx)
  • npx -y react-doctor@latest apps/web --diff main --json --offline --fail-on none (diff scan: score 89/Great on changed file; existing Sidebar diagnostics remain)
  • bun fmt
  • bun lint (passes; existing warnings emitted)
  • bun typecheck
Open in Web View Automation 

Note

Extract PR status rendering into dedicated SidebarThreadPrStatusButton component to reduce rerenders

  • Moves git status lookup, PR resolution, and status indicator rendering out of SidebarThreadRow into a new SidebarThreadPrStatusButton component in Sidebar.tsx
  • Each thread now derives its own projectCwd from the store via environmentId/projectId, removing the need to pass projectCwd down through SidebarProjectItemSidebarProjectThreadListSidebarThreadRow
  • The new component only renders when thread.branch is non-null, scoping re-renders to threads with active branches
  • Before/after recordings are included in react-scan-recordings/ to validate the rerender reduction

Macroscope summarized de766ba.

cursoragent and others added 3 commits May 29, 2026 16:18
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:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels May 29, 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