added auto disconnect when changing link

This commit is contained in:
PxlLoewe
2025-06-02 15:04:15 -07:00
parent 72998a36a4
commit af36b82221
9 changed files with 72 additions and 5 deletions

View File

@@ -43,6 +43,13 @@ export const ConnectionBtn = () => {
}
}, [stations, form.selectedStationId]);
useEffect(() => {
// Disconnect the socket when the component unmounts
return () => {
connection.disconnect();
};
}, [connection.disconnect]);
const session = useSession();
const uid = session.data?.user?.id;
if (!uid) return null;