mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-11 17:00:22 +00:00
Stop AppView from re-subscribing to activeTabId so shell composition no longer rebuilds on every top-tab click; move plugin keybindings and host editor surface visibility into leaf subscribers. Patch session-restore activeTabId without re-serializing every session on tab switches, defer chrome theme CSS work with fingerprint short-circuit + rAF, let terminal workspace chrome read active workspace from the live store, apply TopTabs presentation per tab, and keep hibernate wake chunked/idle with leaner focus scheduling.
52 lines
1.5 KiB
TypeScript
52 lines
1.5 KiB
TypeScript
import { useMemo } from 'react';
|
|
|
|
import type { EditorTabChrome } from '../state/editorTabStore';
|
|
import type { LogView } from '../state/logViewState';
|
|
import type { TerminalSession, Workspace } from '../../types';
|
|
import { useActiveTabId } from '../state/activeTabStore';
|
|
import { isHostTreeWorkTabSurface } from './workTabSurface';
|
|
|
|
/**
|
|
* Subscribes to activeTabId and exposes work-surface visibility without
|
|
* forcing the AppView shell to re-render on every top-tab switch.
|
|
*/
|
|
export function useWorkSurfaceVisible({
|
|
enabled,
|
|
sessions,
|
|
workspaces,
|
|
logViews,
|
|
orderedTabs,
|
|
}: {
|
|
enabled: boolean;
|
|
sessions: TerminalSession[];
|
|
workspaces: Workspace[];
|
|
logViews: readonly LogView[];
|
|
orderedTabs: readonly string[];
|
|
}): boolean {
|
|
const activeTabId = useActiveTabId();
|
|
const sessionIds = useMemo(
|
|
() => new Set(sessions.map((session) => session.id)),
|
|
[sessions],
|
|
);
|
|
const workspaceIds = useMemo(
|
|
() => new Set(workspaces.map((workspace) => workspace.id)),
|
|
[workspaces],
|
|
);
|
|
const logViewIds = useMemo(
|
|
() => new Set(logViews.map((logView) => logView.id)),
|
|
[logViews],
|
|
);
|
|
|
|
return useMemo(() => isHostTreeWorkTabSurface({
|
|
enabled,
|
|
activeTabId,
|
|
logViewIds,
|
|
orderedTabs,
|
|
sessionIds,
|
|
workspaceIds,
|
|
}), [activeTabId, enabled, logViewIds, orderedTabs, sessionIds, workspaceIds]);
|
|
}
|
|
|
|
/** Tiny marker export so tests can pin the isolation helper module. */
|
|
export type WorkSurfaceEditorTabChrome = EditorTabChrome;
|