add ws close wen component unmount

This commit is contained in:
anovazzi1 2023-09-28 17:09:37 -03:00 committed by anovazzi1
commit 588805fe64

View file

@ -330,6 +330,15 @@ export default function FormModal({
// do not add connectWS on dependencies array
}, [open]);
useEffect(() => {
return () => {
if (ws.current) {
console.log("closing ws");
ws.current.close();
}
};
}, []);
useEffect(() => {
if (
ws.current &&