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.

chore(dashboards): remove breakdown colors back-compat re-exports (#73820)

Thomas Obermüllercc513cc3f59e
diff --git a/frontend/src/lib/components/Cards/InsightCard/InsightCard.tsx b/frontend/src/lib/components/Cards/InsightCard/InsightCard.tsx
index 683f02929e8e..9acb7b1667bd 100644
--- a/frontend/src/lib/components/Cards/InsightCard/InsightCard.tsx
+++ b/frontend/src/lib/components/Cards/InsightCard/InsightCard.tsx
@@ -14,7 +14,7 @@ import { SpinnerOverlay } from 'lib/lemon-ui/Spinner/Spinner'
import { themeLogic } from 'lib/logic/themeLogic'
import { accessLevelSatisfied, getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'
import { inStorybook, inStorybookTestRunner } from 'lib/utils/dom'
-import { BreakdownColorConfig } from 'scenes/dashboard/DashboardInsightColorsModal'
+import { BreakdownColorConfig } from 'scenes/dashboard/dashboardBreakdownColors'
import {
InsightErrorState,
InsightLoadingState,
diff --git a/frontend/src/scenes/dashboard/DashboardInsightColorsModal.tsx b/frontend/src/scenes/dashboard/DashboardInsightColorsModal.tsx
index 7d9813e14fe0..c9bbc9046f44 100644
--- a/frontend/src/scenes/dashboard/DashboardInsightColorsModal.tsx
+++ b/frontend/src/scenes/dashboard/DashboardInsightColorsModal.tsx
@@ -17,9 +17,6 @@ import { BreakdownColorConfig, denormalizeBreakdownValue, findBreakdownColorConf
import { dashboardInsightColorsModalLogic } from './dashboardInsightColorsModalLogic'
import { dashboardLogic } from './dashboardLogic'
-// Re-exported for back-compat; the type lives in dashboardBreakdownColors.ts
-export type { BreakdownColorConfig }
-
export function DashboardInsightColorsModal(): JSX.Element {
const { isOpen, insightTilesLoading, breakdownValues } = useValues(dashboardInsightColorsModalLogic)
const { hideInsightColorsModal } = useActions(dashboardInsightColorsModalLogic)
diff --git a/frontend/src/scenes/dashboard/dashboardInsightColorsModalLogic.ts b/frontend/src/scenes/dashboard/dashboardInsightColorsModalLogic.ts
index b30be535079a..a76a7526d627 100644
--- a/frontend/src/scenes/dashboard/dashboardInsightColorsModalLogic.ts
+++ b/frontend/src/scenes/dashboard/dashboardInsightColorsModalLogic.ts
@@ -7,10 +7,6 @@ import type { CountedPaginatedResponse } from '../../lib/api'
import { BreakdownValueAndType, extractBreakdownValues } from './dashboardBreakdownColors'
import { dashboardLogic } from './dashboardLogic'
-// Re-exported for back-compat; the implementation lives in dashboardBreakdownColors.ts
-export { extractBreakdownValues }
-export type { BreakdownValueAndType }
-
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface dashboardInsightColorsModalLogicValues {
allCohorts: CountedPaginatedResponse<CohortType> // cohortsModel
diff --git a/frontend/src/types.ts b/frontend/src/types.ts
index 5acf701caa93..a0ba967111c4 100644
--- a/frontend/src/types.ts
+++ b/frontend/src/types.ts
@@ -34,7 +34,7 @@ import { Dayjs, dayjs } from 'lib/dayjs'
import { PopoverProps } from 'lib/lemon-ui/Popover/Popover'
import type { ProjectSecretAPIKeyAllowedScope } from 'lib/scopes'
import { BehavioralFilterKey, BehavioralFilterType } from 'scenes/cohorts/CohortFilters/types'
-import { BreakdownColorConfig } from 'scenes/dashboard/DashboardInsightColorsModal'
+import { BreakdownColorConfig } from 'scenes/dashboard/dashboardBreakdownColors'
import { AggregationAxisFormat } from 'scenes/insights/aggregationAxisFormat'
import { Params, Scene, SceneConfig, SceneTab } from 'scenes/sceneTypes'
import { SessionRecordingPlayerMode } from 'scenes/session-recordings/player/sessionRecordingPlayerLogic'
diff --git a/posthog/api/test/dashboards/test_dashboard.py b/posthog/api/test/dashboards/test_dashboard.py
index 5ed3040b1882..51d765178bf7 100644
--- a/posthog/api/test/dashboards/test_dashboard.py
+++ b/posthog/api/test/dashboards/test_dashboard.py
@@ -1988,11 +1988,16 @@ class TestDashboard(APIBaseTest, QueryMatchingTest):
def test_dashboard_duplication_copies_breakdown_colors(self):
"""Test that breakdown_colors are copied during duplication"""
+ # The shape the frontend persists: a list of BreakdownColorConfig objects
+ breakdown_colors = [
+ {"breakdownValue": "Chrome", "breakdownType": "event", "colorToken": "preset-1", "source": "manual"},
+ {"breakdownValue": "Firefox", "breakdownType": "event", "colorToken": "preset-2", "source": "manual"},
+ ]
existing_dashboard = Dashboard.objects.create(
team=self.team,
name="Dashboard with colors",
created_by=self.user,
- breakdown_colors={"event1": "#FF0000", "event2": "#00FF00"},
+ breakdown_colors=breakdown_colors,
)
# Duplicate the dashboard
@@ -2001,10 +2006,10 @@ class TestDashboard(APIBaseTest, QueryMatchingTest):
)
# Verify breakdown_colors are copied
- self.assertEqual(response["breakdown_colors"], {"event1": "#FF0000", "event2": "#00FF00"})
+ self.assertEqual(response["breakdown_colors"], breakdown_colors)
duplicated_dashboard = Dashboard.objects.get(id=response["id"])
- self.assertEqual(duplicated_dashboard.breakdown_colors, {"event1": "#FF0000", "event2": "#00FF00"})
+ self.assertEqual(duplicated_dashboard.breakdown_colors, breakdown_colors)
def test_dashboard_duplication_copies_variables(self):
"""Test that variables are copied during duplication"""