feat: disconnect devices on app background mobile

This commit is contained in:
Lucas
2026-11-04 11:08:22 +01:00
parent be713620ef
commit ddb7a907a1
15 changed files with 264 additions and 37 deletions
+4
View File
@@ -14,6 +14,7 @@ import { stopAllPolling } from './dsp/pollRegistry';
import { loadSavedDSPs, saveDSPs, toSaved } from './dsp/dspStorage';
import { DSPMode } from './features/dsp408/types';
import { useIsMobile } from './hooks/useIsMobile';
import { useMobileBackgroundDisconnect } from './dsp/useMobileBackgroundDisconnect';
function App() {
const [dsps, setDsps] = useState<DSP[]>([]);
@@ -30,6 +31,9 @@ function App() {
const dspsRef = useRef(dsps);
dspsRef.current = dsps;
useMobileBackgroundDisconnect(dsps, setDsps, notify); // NEW
useEffect(() => {
return () => stopAllPolling(dspsRef.current);
}, []);