From 22d71ceb142ddda1b2e4c76bd692e8be60dd6927 Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Thu, 24 Apr 2025 13:00:12 +0200 Subject: [PATCH] ui: fixup autoplay on inactive tabs --- frontend/app/components/Session/WebPlayer.tsx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/frontend/app/components/Session/WebPlayer.tsx b/frontend/app/components/Session/WebPlayer.tsx index 874f15bd5..c2289a52d 100644 --- a/frontend/app/components/Session/WebPlayer.tsx +++ b/frontend/app/components/Session/WebPlayer.tsx @@ -57,18 +57,17 @@ function WebPlayer(props: any) { const [fullView, setFullView] = useState(false); React.useEffect(() => { - if (windowActive) { - const handleActivation = () => { - if (!document.hidden) { - setWindowActive(true); - document.removeEventListener('visibilitychange', handleActivation); - } - }; - document.addEventListener('visibilitychange', handleActivation); - } + const handleActivation = () => { + if (!document.hidden) { + setWindowActive(true); + document.removeEventListener('visibilitychange', handleActivation); + } + }; + document.addEventListener('visibilitychange', handleActivation); return () => { devTools.update('network', { activeTab: 'ALL' }); + document.removeEventListener('visibilitychange', handleActivation); } }, []);