fix: prevent session reset when updating host properties (#490)

This commit was merged in pull request #490.
This commit is contained in:
ZacharyZcR
2026-01-12 15:30:01 +08:00
committed by GitHub
parent 5f080be4ee
commit afb66a1098

View File

@@ -1548,7 +1548,11 @@ export const Terminal = forwardRef<TerminalHandle, SSHTerminalProps>(
scheduleNotify(terminal.cols, terminal.rows); scheduleNotify(terminal.cols, terminal.rows);
connectToHost(terminal.cols, terminal.rows); connectToHost(terminal.cols, terminal.rows);
} }
}, [terminal, hostConfig, isVisible, isConnected, isConnecting]); // Note: Using hostConfig.id instead of hostConfig object to prevent
// unnecessary reconnections when host properties are updated.
// Only reconnect when switching to a different host.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [terminal, hostConfig.id, isVisible, isConnected, isConnecting]);
useEffect(() => { useEffect(() => {
if (!terminal || !fitAddonRef.current || !isVisible) return; if (!terminal || !fitAddonRef.current || !isVisible) return;