Do not set websocket to null if in error state.

This commit is contained in:
projectmoon 2024-07-30 19:45:20 +02:00
parent f8f1b31cb3
commit 92cba01e52
1 changed files with 4 additions and 1 deletions

View File

@ -215,7 +215,9 @@ const useSocket = (
ws.onclose = () => {
clearTimeout(timeoutId);
if (!hasError) {
setWs(null); // forces websocket to reopen when needed.
}
console.log('[DEBUG] closed');
};
@ -306,6 +308,7 @@ const ChatWindow = ({ id }: { id?: string }) => {
process.env.NEXT_PUBLIC_WS_URL!,
setIsWSReady,
setHasError,
hasError
);
const [loading, setLoading] = useState(false);