From 22913be04e07997d2e6d6929e89112bc08366a6f Mon Sep 17 00:00:00 2001 From: redesyef Date: Wed, 25 Sep 2024 16:48:09 -0500 Subject: [PATCH] fixed error visual with socket --- ui/components/ChatWindow.tsx | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/ui/components/ChatWindow.tsx b/ui/components/ChatWindow.tsx index c45b2f9..e82d386 100644 --- a/ui/components/ChatWindow.tsx +++ b/ui/components/ChatWindow.tsx @@ -181,11 +181,11 @@ const useSocket = ( toast.error('WebSocket connection error.'); }; - ws.onclose = () => { - clearTimeout(timeoutId); - setError(true); - console.log('[DEBUG] closed'); - }; + // ws.onclose = () => { + // clearTimeout(timeoutId); + // setError(true); + // console.log('[DEBUG] closed'); + // }; ws.addEventListener('message', (e) => { const data = JSON.parse(e.data); @@ -529,16 +529,17 @@ const ChatWindow = ({ id }: { id?: string }) => { } // eslint-disable-next-line react-hooks/exhaustive-deps }, [messages]); + console.log(hasError); - if (hasError) { - return ( -
-

- Failed to connect to the server. Please try again later. -

-
- ); - } + // if (hasError) { + // return ( + //
+ //

+ // Failed to connect to the server. Please try again later. + //

+ //
+ // ); + // } return isReady ? ( notFound ? (