mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-10-09 15:58:34 +00:00
c239f30653
Decouple high-frequency UI state from TerminalLayer's memo boundary so npm run dev is less dominated by full-layer reconciliation. - Publish shell history through shellHistoryStore; History side panel subscribes directly instead of receiving shellHistory props. - Track terminal CWD in terminalCwdStore so OSC 7 updates do not setState TerminalLayerInner; TabBridge updates side-panel live snapshots only. - Move remote-history ownership into the History side-panel slot. - Treat sessions as equal for pane/layer memo when only dynamicTitle or codingCliProviderId changes (TopTabs still sees full session updates). - Stabilize AppView terminal handlers; thin AI vault catalog props when the AI panel is not visible; memo HostTreeView.
30 lines
947 B
TypeScript
30 lines
947 B
TypeScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
|
|
import {
|
|
getShellHistorySnapshot,
|
|
publishShellHistorySnapshot,
|
|
subscribeShellHistory,
|
|
} from './shellHistoryStore.ts';
|
|
|
|
test('shellHistoryStore notifies subscribers only when the snapshot identity changes', () => {
|
|
const events: number[] = [];
|
|
const unsubscribe = subscribeShellHistory(() => {
|
|
events.push(getShellHistorySnapshot().length);
|
|
});
|
|
|
|
const first = [{ id: '1', command: 'ls', hostId: 'h', hostLabel: 'h', sessionId: 's', timestamp: 1 }];
|
|
publishShellHistorySnapshot(first);
|
|
assert.equal(events.at(-1), 1);
|
|
assert.equal(getShellHistorySnapshot(), first);
|
|
|
|
publishShellHistorySnapshot(first);
|
|
assert.equal(events.length, 1);
|
|
|
|
const second = [...first, { id: '2', command: 'pwd', hostId: 'h', hostLabel: 'h', sessionId: 's', timestamp: 2 }];
|
|
publishShellHistorySnapshot(second);
|
|
assert.equal(events.at(-1), 2);
|
|
|
|
unsubscribe();
|
|
});
|