fix(dashboard): deduplicate realtime log replay

This commit is contained in:
jjbrunton committed 2026-08-08 15:15:54 +01:00
1 parent e003b0d8b2
commit 89f7376b1b
4 files changed
+49 -9

No files matched your search

@@ -38,4 +38,19 @@ describe('live console state', () => {
expect(state.entries.map(({ id }) => id)).toEqual(['3', '4']);
expect(state.pendingEntries).toEqual([]);
});
it('deduplicates the same log delivered by the initial snapshot and SSE replay', () => {
let state = createLiveConsoleState();
state = reduceLiveConsoleState(state, {
type: 'append',
entry: entry('initial-1', 'info', 'Database initialized'),
});
state = reduceLiveConsoleState(state, {
type: 'append',
entry: entry('realtime-1', 'info', 'Database initialized'),
});
expect(state.entries).toHaveLength(1);
expect(state.entries[0]?.id).toBe('initial-1');
});
});