:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(scenes): only sync pinned tabs from storage while visible (#58359)
Paul D'Ambra2a32d958d064
diff --git a/frontend/src/scenes/sceneLogic.tsx b/frontend/src/scenes/sceneLogic.tsxindex a32498b8c698..1201e6a308a1 100644--- a/frontend/src/scenes/sceneLogic.tsx+++ b/frontend/src/scenes/sceneLogic.tsx@@ -1727,12 +1727,27 @@ export const sceneLogic = kea<sceneLogicType>([if (event.key !== getStorageKey(PINNED_TAB_STATE_KEY)) {return}+ // Skip while hidden so backgrounded tabs don't re-mount on every remote nav.+ // The visibilitychange handler below catches up when the tab is foregrounded.+ if (document.visibilityState !== 'visible') {+ return+ }syncPinnedTabsFromStorage()}+ const onVisibility = (): void => {+ if (document.visibilityState === 'visible') {+ syncPinnedTabsFromStorage()+ }+ }+syncPinnedTabsFromStorage()window.addEventListener('storage', onStorage)- return () => window.removeEventListener('storage', onStorage)+ document.addEventListener('visibilitychange', onVisibility)+ return () => {+ window.removeEventListener('storage', onStorage)+ document.removeEventListener('visibilitychange', onVisibility)+ }},'pinnedTabsStorageListener',// Passive storage listener — no need to tear down/re-setup on visibility change.