Skip to content

: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.

fix(logs): persist viewer state across tab switches (#67023)

Jon McCallum3a93b471498b
diff --git a/products/logs/frontend/LogsScene.tsx b/products/logs/frontend/LogsScene.tsx
index 4e3e1142fba5..e6022c717377 100644
--- a/products/logs/frontend/LogsScene.tsx
+++ b/products/logs/frontend/LogsScene.tsx
@@ -6,6 +6,7 @@ import { LemonBanner, LemonButton, LemonTabs } from '@posthog/lemon-ui'
import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { IconFeedback } from 'lib/lemon-ui/icons'
+import { cn } from 'lib/utils/css-classes'
import { sceneConfigurations } from 'scenes/scenes'
import { Scene, SceneExport } from 'scenes/sceneTypes'
import { Settings } from 'scenes/settings/Settings'
@@ -135,13 +136,16 @@ const LogsSceneTabbedContent = (): JSX.Element => {
tabs={tabs}
sceneInset
/>
- {activeTab === 'viewer' && (
+ {/* Keep the viewer mounted across tab switches (just hidden when inactive) so its loaded
+ logs, scroll position, and virtualized-list state survive — switching away and back
+ should not replay the initial loading animation. */}
+ <div className={cn('flex flex-col flex-1 min-h-0', activeTab !== 'viewer' && 'hidden')}>
<LogsSetupPrompt>
<div className="flex flex-col gap-2 py-2 flex-1 min-h-0">
<LogsViewer id={LOGS_SCENE_VIEWER_ID} showSavedViewsButton />
</div>
</LogsSetupPrompt>
- )}
+ </div>
{activeTab === 'services' && showServicesView && (
<>
<LogsServices />