Skip to content

Avoid rerendering suggested SSH host rows#3556

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

Avoid rerendering suggested SSH host rows#3556
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/component-performance-optimization-886f

Conversation

@cursor

@cursor cursor Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

What Changed

  • Replaced the per-row inline onConnect wrapper for discovered SSH hosts with the stable connect handler.
  • Added an explicit memo comparator for DesktopSshHostRow so unchanged discovered host rows are compared by displayed target fields and connection state instead of relying only on object identity.

Why

React Doctor flagged DesktopSshHostRow as a memoized component receiving an inline function prop, which forced every suggested SSH host row to redraw on unrelated parent updates. React Scan confirmed the static suggested host rows rerendered on every Host/Alias keystroke in the Add Environment SSH dialog. Passing a stable handler and comparing row props by value lets these rows skip unrelated parent renders.

UI Changes

React Scan recordings captured during local validation:

  • Before: connections_ssh_rows_react_scan_before.mp4 shows devbox/staging/builder rows flashing on each Host/Alias keystroke.
  • After: connections_ssh_rows_react_scan_after.mp4 shows only parent/dialog containers flashing; individual suggested host rows no longer flash.

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 --project @t3tools/web --category performance --verbose --json rerun: web performance diagnostics dropped from 134 to 133; warnings dropped from 61 to 60. Remaining failures are pre-existing unrelated diagnostics.
  • vp check passed with existing warnings.
  • vp run typecheck passed.
Open in Web View Automation 

Note

Avoid rerendering DesktopSshHostRow when props are unchanged

Wraps DesktopSshHostRow in React.memo with a custom comparator (areDesktopSshHostRowPropsEqual) that skips re-renders unless connectingHostAlias, onConnect, or any of target.alias/hostname/username/port/source change. Also replaces the inline arrow function passed as onConnect with a stable handleConnectSshHost reference so the comparator can short-circuit on reference equality.

Macroscope summarized 0bab680.

cursoragent and others added 2 commits June 25, 2026 16:29
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:S 10-29 changed lines (additions + deletions). labels Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 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