From ceea512693a348e0c7eaa2f059b3aaaefeb55bf0 Mon Sep 17 00:00:00 2001 From: Kaiohz Date: Thu, 21 May 2026 09:04:30 +0200 Subject: [PATCH] BRIC-18: add openWhenHidden:true to prevent stream reconnection on tab switch Prevents @microsoft/fetch-event-source from aborting and reconnecting the SSE stream when the browser tab becomes hidden, which would cause duplicate HUMAN messages to be persisted. --- src/infrastructure/api/chat/chatApi.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/infrastructure/api/chat/chatApi.ts b/src/infrastructure/api/chat/chatApi.ts index c8698b2..13ea78e 100644 --- a/src/infrastructure/api/chat/chatApi.ts +++ b/src/infrastructure/api/chat/chatApi.ts @@ -76,6 +76,7 @@ export const chatApi: IChatPort = { headers: { "Content-Type": "application/json" }, body: JSON.stringify(request), signal: ctrl.signal, + openWhenHidden: true, onmessage(ev) { if (ev.data === "[DONE]") return; if (!ev.data) return;