Files
Netcatty/components/terminalLayer/TerminalLayerHostTreeSection.tsx
T
陈大猫andCursor 36e5779d94 perf(terminal): reduce terminal tab-switch and layout jank (#1321)
* perf(terminal): smooth layout drags and faster tab switching

Defer xterm refit during split, sidebar, and host-tree drags while keeping pane containers in sync with live layout measurements. Refactor TerminalLayer into focused sections with TabBridge/memo optimizations and add the terminal host tree sidebar.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(terminal): keep side panels alive and guard session attach races

Prevent terminal boot unmount from leaking backend sessions, keep SFTP/scripts/theme/AI state when switching side tabs, and defer heavy SFTP UI mount so first entry stays responsive.

Co-authored-by: Cursor <cursoragent@cursor.com>

* perf(terminal): reduce tab switch jank

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-09 03:35:03 +08:00

27 lines
913 B
TypeScript

/* eslint-disable @typescript-eslint/no-explicit-any */
import React, { memo } from 'react';
import { TerminalHostTreeSidebar } from './TerminalHostTreeSidebar';
import { terminalLayerHostTreePropsEqual } from './terminalLayerViewMemo';
type HostTreeContext = Record<string, any>;
function TerminalLayerHostTreeSectionInner({ ctx }: { ctx: HostTreeContext }) {
return (
<TerminalHostTreeSidebar
hosts={ctx.hosts}
customGroups={ctx.customGroups}
resolvedPreviewTheme={ctx.resolvedPreviewTheme}
activeHostId={ctx.activeHostIdForSidebar}
onConnect={ctx.onConnectToHost}
onCreateLocalTerminal={ctx.onCreateLocalTerminal}
/>
);
}
export const TerminalLayerHostTreeSection = memo(
TerminalLayerHostTreeSectionInner,
(prev, next) => terminalLayerHostTreePropsEqual(prev.ctx, next.ctx),
);
TerminalLayerHostTreeSection.displayName = 'TerminalLayerHostTreeSection';