* 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>
39 lines
846 B
TypeScript
39 lines
846 B
TypeScript
import React, { startTransition, useEffect } from 'react';
|
|
|
|
type SftpSidePanelDeferredMountProps = {
|
|
children: React.ReactNode;
|
|
ready: boolean;
|
|
onReady: () => void;
|
|
};
|
|
|
|
export const SftpSidePanelDeferredMount: React.FC<SftpSidePanelDeferredMountProps> = ({
|
|
children,
|
|
ready,
|
|
onReady,
|
|
}) => {
|
|
useEffect(() => {
|
|
if (ready) return;
|
|
|
|
let cancelled = false;
|
|
const frameId = requestAnimationFrame(() => {
|
|
if (cancelled) return;
|
|
startTransition(() => onReady());
|
|
});
|
|
|
|
return () => {
|
|
cancelled = true;
|
|
cancelAnimationFrame(frameId);
|
|
};
|
|
}, [ready, onReady]);
|
|
|
|
if (!ready) {
|
|
return (
|
|
<div className="absolute inset-0 z-10 flex h-full items-center justify-center bg-background text-xs text-muted-foreground">
|
|
Loading…
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return <>{children}</>;
|
|
};
|