fixed error visual with socket
This commit is contained in:
parent
7a887f59bc
commit
22913be04e
1 changed files with 15 additions and 14 deletions
|
@ -181,11 +181,11 @@ const useSocket = (
|
||||||
toast.error('WebSocket connection error.');
|
toast.error('WebSocket connection error.');
|
||||||
};
|
};
|
||||||
|
|
||||||
ws.onclose = () => {
|
// ws.onclose = () => {
|
||||||
clearTimeout(timeoutId);
|
// clearTimeout(timeoutId);
|
||||||
setError(true);
|
// setError(true);
|
||||||
console.log('[DEBUG] closed');
|
// console.log('[DEBUG] closed');
|
||||||
};
|
// };
|
||||||
|
|
||||||
ws.addEventListener('message', (e) => {
|
ws.addEventListener('message', (e) => {
|
||||||
const data = JSON.parse(e.data);
|
const data = JSON.parse(e.data);
|
||||||
|
@ -529,16 +529,17 @@ const ChatWindow = ({ id }: { id?: string }) => {
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [messages]);
|
}, [messages]);
|
||||||
|
console.log(hasError);
|
||||||
|
|
||||||
if (hasError) {
|
// if (hasError) {
|
||||||
return (
|
// return (
|
||||||
<div className="flex flex-col items-center justify-center min-h-screen">
|
// <div className="flex flex-col items-center justify-center min-h-screen">
|
||||||
<p className="dark:text-white/70 text-black/70 text-sm">
|
// <p className="dark:text-white/70 text-black/70 text-sm">
|
||||||
Failed to connect to the server. Please try again later.
|
// Failed to connect to the server. Please try again later.
|
||||||
</p>
|
// </p>
|
||||||
</div>
|
// </div>
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
return isReady ? (
|
return isReady ? (
|
||||||
notFound ? (
|
notFound ? (
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue