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(error-tracking): keep breakdownFiltersLogic mounted at scene root (#66547)

posthog[bot]3794dddae8db
diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/ErrorTrackingIssueScene.tsx b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/ErrorTrackingIssueScene.tsx
index 00be330ed2c5..3aada1a2fc2c 100644
--- a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/ErrorTrackingIssueScene.tsx
+++ b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/ErrorTrackingIssueScene.tsx
@@ -1,7 +1,7 @@
import '../ErrorTrackingIssueScene/ErrorTrackingIssueScene.scss'
import clsx from 'clsx'
-import { BindLogic, useActions, useValues } from 'kea'
+import { BindLogic, useActions, useMountedLogic, useValues } from 'kea'
import posthog from 'posthog-js'
import { useEffect, useRef } from 'react'
@@ -34,6 +34,7 @@ import { FilterLogicalOperator, PropertyFilterType, PropertyOperator, ReplayTabs
import { useAttachedContext } from 'products/posthog_ai/frontend/api/logics'
import { PostHogSDKIssueBanner } from '../../components/Banners/PostHogSDKIssueBanner'
+import { breakdownFiltersLogic } from '../../components/Breakdowns/breakdownFiltersLogic'
import { BreakdownsChart } from '../../components/Breakdowns/BreakdownsChart'
import { BreakdownsSearchBar } from '../../components/Breakdowns/BreakdownsSearchBar'
import { MiniBreakdowns } from '../../components/Breakdowns/MiniBreakdowns'
@@ -77,6 +78,12 @@ export function ErrorTrackingIssueScene(): JSX.Element {
const sceneMenuBarEnabled = useFeatureFlag('SCENE_MENU_BAR')
const hasIssueSplitting = useFeatureFlag('ERROR_TRACKING_ISSUE_SPLITTING')
+ // breakdownFiltersLogic is a keyless singleton that miniBreakdownsLogic connects to. Mounting it here ties its
+ // lifecycle to the scene (the stable parent), so it is torn down after the keyed miniBreakdownsLogic below rather
+ // than mid-cascade — otherwise its store path can vanish while miniBreakdownsLogic's connected selectors still
+ // re-evaluate, throwing "Can not find path breakdownFiltersLogic".
+ useMountedLogic(breakdownFiltersLogic)
+
useAttachedContext(
issueId ? [{ type: 'error_tracking_issue', key: issueId, label: issue?.name ?? undefined }] : null
)