fix(frontend): reconnect stream on same-session resume

This commit is contained in:
User
2026-07-14 20:53:19 +02:00
parent b1d1284cc8
commit 1393c6358e
5 changed files with 90 additions and 47 deletions
@@ -46,3 +46,17 @@ test("closes the stream on unmount", () => {
unmount();
expect(es.closed).toBe(true);
});
test("reconnects the same session when the generation changes", () => {
const { rerender } = renderHook(
({ generation }) => useSessionStream("s1", generation),
{ initialProps: { generation: 0 } },
);
const first = FakeEventSource.instances[0];
rerender({ generation: 1 });
expect(first.closed).toBe(true);
expect(FakeEventSource.instances).toHaveLength(2);
expect(FakeEventSource.instances[1].url).toBe(first.url);
});