Skip to content

Optimize sidebar thread rename rerenders#3001

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

Optimize sidebar thread rename rerenders#3001
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/component-performance-optimization-3eb4

Conversation

@cursor

@cursor cursor Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

What Changed

  • Moved sidebar thread rename draft text into a small SidebarThreadRenameInput child component.
  • Replaced the row-level rename props (renamingTitle, setter, shared input/commit refs) with a per-row isRenaming boolean.
  • Kept commit/cancel behavior unchanged while preventing typed rename text from invalidating every memoized visible thread row.

Why

React Doctor was run for @t3tools/web and reported broad pre-existing React/performance/maintainability diagnostics (1199 total). A manual hotspot pass identified sidebar rename as a focused runtime issue: each keystroke updated SidebarProjectItem state and passed a new renamingTitle prop to every SidebarThreadRow, forcing all visible rows to rerender.

React Scan before/after metrics for the same three-thread rename interaction:

  • Before: SidebarThreadRow rendered 27 times; total sidebar scan events 117.
  • After: SidebarThreadRow rendered 2 times; keystrokes render only SidebarThreadRenameInput (7 events); total sidebar scan events 21.

UI Changes

React Scan recordings captured during validation:

  • react_scan_sidebar_rename_before.webm
  • react_scan_sidebar_rename_after.webm
  • Metrics JSON: sidebar_rename_before_metrics.json, sidebar_rename_after_metrics.json

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:

  • corepack pnpm exec vp check
  • corepack pnpm exec vp run typecheck
Open in Web View Automation 

Note

Optimize sidebar thread rename rerenders by isolating rename state in SidebarThreadRenameInput

  • Extracts rename input logic into a new memoized SidebarThreadRenameInput component in Sidebar.tsx, so only the actively-renamed row re-renders during typing.
  • SidebarThreadRow now receives a single isRenaming boolean instead of the previous group of renaming props (renamingTitle, setRenamingTitle, renamingInputRef, renamingCommittedRef).
  • Local title state, focus-on-mount, commit-on-blur/Enter, and cancel-on-Escape are all self-contained within SidebarThreadRenameInput.

Macroscope summarized e0909c5.

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:L 100-499 changed lines (additions + deletions). labels Jun 8, 2026
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

🚀 Expo continuous deployment is ready!

  • Project → t3-code
  • Platforms → android, ios
  • Scheme → t3code-preview
  🤖 Android 🍎 iOS
Fingerprint ae17d94b35f91f9c608a63dadbc3ddd9f4ba056e 313e506a7f15a9c3f15b01d787d68a12382432bf
Build Details Build Permalink
DetailsDistribution: INTERNAL
Build profile: preview:dev
Runtime version: ae17d94b35f91f9c608a63dadbc3ddd9f4ba056e
App version: 0.1.0
Git commit: b192ffde2032d73c7c9c84d48ed50cff058feb24
Build Permalink
DetailsDistribution: INTERNAL
Build profile: preview:dev
Runtime version: 313e506a7f15a9c3f15b01d787d68a12382432bf
App version: 0.1.0
Git commit: b192ffde2032d73c7c9c84d48ed50cff058feb24
Update Details Update Permalink
DetailsBranch: pr-3001
Runtime version: ae17d94b35f91f9c608a63dadbc3ddd9f4ba056e
Git commit: b192ffde2032d73c7c9c84d48ed50cff058feb24
Update Permalink
DetailsBranch: pr-3001
Runtime version: 313e506a7f15a9c3f15b01d787d68a12382432bf
Git commit: b192ffde2032d73c7c9c84d48ed50cff058feb24
Update QR

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