Do not set websocket to null if in error state.
This commit is contained in:
parent
f8f1b31cb3
commit
92cba01e52
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue