From 588805fe64e2f5871868f46cbe99670cc54b70ac Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Thu, 28 Sep 2023 17:09:37 -0300 Subject: [PATCH] add ws close wen component unmount --- src/frontend/src/modals/formModal/index.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/frontend/src/modals/formModal/index.tsx b/src/frontend/src/modals/formModal/index.tsx index 0952cd2f0..aae20f160 100644 --- a/src/frontend/src/modals/formModal/index.tsx +++ b/src/frontend/src/modals/formModal/index.tsx @@ -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 &&