From 5cd5d2c33711743723010c79c2d440f274b4a29b Mon Sep 17 00:00:00 2001 From: PxlLoewe <72106766+PxlLoewe@users.noreply.github.com> Date: Tue, 3 Jun 2025 23:20:20 -0700 Subject: [PATCH] added auto Disconnect for dispatcher --- .../dispatch/_components/navbar/_components/Connection.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/dispatch/app/dispatch/_components/navbar/_components/Connection.tsx b/apps/dispatch/app/dispatch/_components/navbar/_components/Connection.tsx index cdb98ab8..7202b934 100644 --- a/apps/dispatch/app/dispatch/_components/navbar/_components/Connection.tsx +++ b/apps/dispatch/app/dispatch/_components/navbar/_components/Connection.tsx @@ -49,6 +49,13 @@ export const ConnectionBtn = () => { }; }, [form.logoffTime, connection.connectedDispatcher]); + useEffect(() => { + // Disconnect the socket when the component unmounts + return () => { + connection.disconnect(); + }; + }, [connection.disconnect]); + return (