fix(Dashboard): attach visibilitychange listener to document

The visibilitychange event is dispatched on document, not window,
so listening on window prevented browser-tab hide/show logging
from firing.
This commit is contained in:
Evan Rusackas
2026-04-22 12:37:06 -07:00
committed by Claude
parent 4ca644394f
commit 08a9b73bd2

View File

@@ -296,11 +296,11 @@ function Dashboard({
ts: new Date().getTime(),
};
}
window.addEventListener('visibilitychange', onVisibilityChange);
document.addEventListener('visibilitychange', onVisibilityChange);
// componentWillUnmount equivalent
return () => {
window.removeEventListener('visibilitychange', onVisibilityChange);
document.removeEventListener('visibilitychange', onVisibilityChange);
onBeforeUnload(false); // Remove beforeunload listener on unmount
actions.clearDataMaskState();
actions.clearAllChartStates();