Harden dashboard realtime state and controls

This commit is contained in:
jjbrunton committed 2026-08-08 15:38:11 +01:00
1 parent 70d62b2da3
commit 64d29e1241
21 files changed
+423 -30

No files matched your search

+18
View File
@@ -57,6 +57,24 @@ describe('dashboard realtime client', () => {
expect(client.getSnapshot()).toMatchObject({ status: 'closed', isStale: true });
});
it('requests an authoritative repair on initial connection and every reconnect', () => {
const source = new FakeEventSource();
const connected = vi.fn();
const client = createDashboardRealtimeClient({
sourceFactory: () => source,
onEvent: vi.fn(),
onConnected: connected,
});
client.start();
source.emit('open');
source.emit('error');
source.emit('open');
expect(connected).toHaveBeenNthCalledWith(1, { isReconnect: false });
expect(connected).toHaveBeenNthCalledWith(2, { isReconnect: true });
});
it('maps events to the queries whose authoritative snapshots need refresh', () => {
expect(
queryKeysForDashboardEvent({