From 9eba3e70bb12296a21a9cc49404057361f1c58da Mon Sep 17 00:00:00 2001 From: Kyrylo Shmidt Date: Wed, 9 Jul 2025 13:19:34 +0200 Subject: [PATCH 1/2] Keep connection open even if tab is hidden --- .../IncidentsContainer/CreateIncidentChatOverlay/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/Agentic/IncidentsContainer/CreateIncidentChatOverlay/index.tsx b/src/components/Agentic/IncidentsContainer/CreateIncidentChatOverlay/index.tsx index beafbbbc..42e31555 100644 --- a/src/components/Agentic/IncidentsContainer/CreateIncidentChatOverlay/index.tsx +++ b/src/components/Agentic/IncidentsContainer/CreateIncidentChatOverlay/index.tsx @@ -91,6 +91,7 @@ export const CreateIncidentChatOverlay = () => { body: JSON.stringify({ text }), + openWhenHidden: true, onopen: (response: Response) => { if (response.ok) { setIncidentId( From 5738115c5e6afcc5524cd0b3b4c6eb048fe17b88 Mon Sep 17 00:00:00 2001 From: Kyrylo Shmidt Date: Wed, 9 Jul 2025 13:38:26 +0200 Subject: [PATCH 2/2] Disable SSE requests retries --- src/components/Agentic/IncidentDirectives/index.tsx | 13 ++++++++----- .../CreateIncidentChatOverlay/index.tsx | 12 +++++++----- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/components/Agentic/IncidentDirectives/index.tsx b/src/components/Agentic/IncidentDirectives/index.tsx index 3ad4f42c..4de34421 100644 --- a/src/components/Agentic/IncidentDirectives/index.tsx +++ b/src/components/Agentic/IncidentDirectives/index.tsx @@ -157,6 +157,7 @@ export const IncidentDirectives = () => { text, ids: selectedConditions }), + openWhenHidden: true, onopen: (response: Response) => { if (response.ok) { setConversationId( @@ -186,13 +187,15 @@ export const IncidentDirectives = () => { onerror: (err: unknown) => { abortControllerRef.current = null; setIsStartMessageSending(false); + let errorMessage = "Unknown error starting directives chat"; if (err instanceof Error) { - // eslint-disable-next-line no-console - console.error("Error starting directives chat:", err); - } else { - // eslint-disable-next-line no-console - console.error("Unknown error starting directives chat"); + errorMessage = err.message; } + + // eslint-disable-next-line no-console + console.error(errorMessage); + + throw new Error(errorMessage); // Rethrow the error to avoid retrying }, onclose: () => { abortControllerRef.current = null; diff --git a/src/components/Agentic/IncidentsContainer/CreateIncidentChatOverlay/index.tsx b/src/components/Agentic/IncidentsContainer/CreateIncidentChatOverlay/index.tsx index 42e31555..49f74656 100644 --- a/src/components/Agentic/IncidentsContainer/CreateIncidentChatOverlay/index.tsx +++ b/src/components/Agentic/IncidentsContainer/CreateIncidentChatOverlay/index.tsx @@ -139,13 +139,15 @@ export const CreateIncidentChatOverlay = () => { onerror: (err: unknown) => { abortControllerRef.current = null; setIsStartMessageSending(false); + let errorMessage = "Unknown error starting incident creation chat"; if (err instanceof Error) { - // eslint-disable-next-line no-console - console.error("Error starting incident creation chat:", err); - } else { - // eslint-disable-next-line no-console - console.error("Unknown error starting incident creation chat"); + errorMessage = err.message; } + + // eslint-disable-next-line no-console + console.error(errorMessage); + + throw new Error(errorMessage); // Rethrow the error to avoid retrying }, onclose: () => { abortControllerRef.current = null;