fix(formModal): remove connectWS from dependencies array in useEffect to prevent unnecessary reconnections

fix(formModal): remove connectWS from dependencies array in useEffect to prevent unnecessary reconnections
This commit is contained in:
anovazzi1 2023-07-11 11:58:48 -03:00
commit 96b432d127

View file

@ -292,7 +292,8 @@ export default function FormModal({
ws.current.close(); ws.current.close();
} }
}; };
}, [connectWS]); // do not add connectWS on dependencies array
}, []);
useEffect(() => { useEffect(() => {
if ( if (
@ -303,7 +304,8 @@ export default function FormModal({
connectWS(); connectWS();
setLockChat(false); setLockChat(false);
} }
}, [lockChat, connectWS]); // do not add connectWS on dependencies array
}, [lockChat]);
async function sendAll(data: sendAllProps) { async function sendAll(data: sendAllProps) {
try { try {