add ws close wen component unmount
This commit is contained in:
parent
4e48360e2a
commit
588805fe64
1 changed files with 9 additions and 0 deletions
|
|
@ -330,6 +330,15 @@ export default function FormModal({
|
||||||
// do not add connectWS on dependencies array
|
// do not add connectWS on dependencies array
|
||||||
}, [open]);
|
}, [open]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
return () => {
|
||||||
|
if (ws.current) {
|
||||||
|
console.log("closing ws");
|
||||||
|
ws.current.close();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (
|
if (
|
||||||
ws.current &&
|
ws.current &&
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue