From 7eb0148e8639742894a8523ce2725d4cd2d8f429 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Sat, 30 May 2026 01:36:59 -0700 Subject: [PATCH] perf: guard SSH target row async state without effect (#3556) --- src/renderer/src/components/sidebar/SshTargetRow.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/renderer/src/components/sidebar/SshTargetRow.tsx b/src/renderer/src/components/sidebar/SshTargetRow.tsx index 30338596f..228c00124 100644 --- a/src/renderer/src/components/sidebar/SshTargetRow.tsx +++ b/src/renderer/src/components/sidebar/SshTargetRow.tsx @@ -4,7 +4,7 @@ * Why extracted: keeps AddRepoSteps.tsx under the 400-line oxlint limit * while isolating the inline-connect interaction logic. */ -import React, { useEffect, useRef, useState } from 'react' +import React, { useCallback, useRef, useState } from 'react' import { Loader2 } from 'lucide-react' import type { SshTarget, SshConnectionState } from '../../../../shared/ssh-types' @@ -57,15 +57,15 @@ export function SshTargetRow({ }) } - useEffect(() => { - mountedRef.current = true - return () => { - mountedRef.current = false - } + const handleRowRootRef = useCallback((node: HTMLDivElement | null): void => { + // Why: SSH connects can resolve after this row is removed; the row ref + // gives the async completion the same guard without a mount-only Effect. + mountedRef.current = node !== null }, []) return (