From 5d749c09a7fbe482f4f2fc9ccc07fd6cc8f6554b Mon Sep 17 00:00:00 2001 From: Untone Date: Wed, 11 Oct 2023 17:41:36 +0300 Subject: [PATCH] add-fetch-eventsource-close-on-error --- src/context/inbox.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/context/inbox.tsx b/src/context/inbox.tsx index 92c82f93..d7a73cfc 100644 --- a/src/context/inbox.tsx +++ b/src/context/inbox.tsx @@ -46,11 +46,12 @@ export const InboxProvider = (props: { children: JSX.Element }) => { console.log(message) }, onclose() { - // if the server closes the connection unexpectedly, retry: + // if no error thrown - it will reconnect console.log("sse connection closed") }, onerror(err) { console.warn(err) + throw new Error() // hack to close the connection } })