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 = () => {
|
ws.onclose = () => {
|
||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
|
if (!hasError) {
|
||||||
setWs(null); // forces websocket to reopen when needed.
|
setWs(null); // forces websocket to reopen when needed.
|
||||||
|
}
|
||||||
console.log('[DEBUG] closed');
|
console.log('[DEBUG] closed');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -306,6 +308,7 @@ const ChatWindow = ({ id }: { id?: string }) => {
|
||||||
process.env.NEXT_PUBLIC_WS_URL!,
|
process.env.NEXT_PUBLIC_WS_URL!,
|
||||||
setIsWSReady,
|
setIsWSReady,
|
||||||
setHasError,
|
setHasError,
|
||||||
|
hasError
|
||||||
);
|
);
|
||||||
|
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
Loading…
Reference in New Issue