From 0360e3726ecfd83b2d9a89f5ea97d9132515d23f 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 | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/frontend/app/components/Session/WebPlayer.tsx b/frontend/app/components/Session/WebPlayer.tsx index d0fff842d..c2289a52d 100644 --- a/frontend/app/components/Session/WebPlayer.tsx +++ b/frontend/app/components/Session/WebPlayer.tsx @@ -38,8 +38,8 @@ function WebPlayer(props: any) { uxtestingStore, uiPlayerStore, integrationsStore, - userStore, } = useStore(); + const devTools = sessionStore.devTools const session = sessionStore.current; const { prefetched } = sessionStore; const startedAt = sessionStore.current.startedAt || 0; @@ -57,14 +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); } }, []);