From 94b284997165f97030abbca60c40bc1207b8d11d Mon Sep 17 00:00:00 2001 From: Bas van den Aakster Date: Fri, 14 Nov 2025 19:48:23 +0100 Subject: [PATCH] Fix: Add cleanup on component unmount MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Close all connections when component unmounts - Prevents polling timers from running after unmount - Better resource cleanup 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/App.jsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/App.jsx b/src/App.jsx index 7dea838..6021a13 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -71,6 +71,14 @@ export default function App() { } }, []); + // Cleanup on unmount + useEffect(() => { + return () => { + // Close all connections when component unmounts + myConnections.forEach(c => c.conn?.close()); + }; + }, [myConnections]); + // Register const handleRegister = async () => { if (!client) return;