Skip to content

Stabilize discovered SSH host row handler#3485

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

Stabilize discovered SSH host row handler#3485
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/component-performance-optimization-e0ce

Conversation

@cursor

@cursor cursor Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

What Changed

  • Replaced the inline onConnect closure passed to each memoized DesktopSshHostRow with a stable useCallback handler.
  • Keeps suggested SSH host rows eligible to skip re-rendering when unrelated parent state changes, such as typing in the manual SSH host field.

Why

React Doctor flagged ConnectionsSettings.tsx for no-inline-prop-on-memo-component at the discovered SSH host rows. The inline function changed identity on every parent render, defeating memo() for every suggested host row. A stable callback preserves behavior while allowing those rows to avoid unnecessary renders.

UI Changes

Interaction behavior is unchanged. React Scan recordings captured the render behavior:

  • Before: /opt/cursor/artifacts/react_scan_before_ssh_host_rows.mp4
  • After: /opt/cursor/artifacts/react_scan_after_ssh_host_rows.mp4

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
Open in Web View Automation 

Note

Memoize onConnect handler for discovered SSH host rows in ConnectionsSettings

Replaces the inline arrow function passed as onConnect to DesktopSshHostRow with a useCallback-memoized handler (handleConnectDiscoveredSshHost). This stabilizes the prop reference across renders when handleConnectSshHost is unchanged, avoiding unnecessary re-renders of DesktopSshHostRow.

Macroscope summarized 1738ae8.

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:XS 0-9 changed lines (additions + deletions). labels Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 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