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(web-analytics): guard HeatmapButton against non-string values (#59918)

posthog[bot]69fec247b1af
diff --git a/frontend/src/scenes/web-analytics/CrossSellButtons/HeatmapButton.tsx b/frontend/src/scenes/web-analytics/CrossSellButtons/HeatmapButton.tsx
index 2e584743ee50..ac78f14f3816 100644
--- a/frontend/src/scenes/web-analytics/CrossSellButtons/HeatmapButton.tsx
+++ b/frontend/src/scenes/web-analytics/CrossSellButtons/HeatmapButton.tsx
@@ -12,7 +12,7 @@ import { webAnalyticsLogic } from '../webAnalyticsLogic'
interface HeatmapButtonProps {
breakdownBy: WebStatsBreakdown
- value: string
+ value: unknown
}
// Currently can only support breakdown where the value is a pathname
@@ -27,8 +27,9 @@ const VALID_BREAKDOWN_VALUES = new Set([
export const HeatmapButton = ({ breakdownBy, value }: HeatmapButtonProps): JSX.Element => {
const { domainFilter: webAnalyticsSelectedDomain } = useValues(webAnalyticsLogic)
- // Doesn't make sense to show the button if there's no value
- if (value === '') {
+ // Some breakdown strategies surface tuples or numbers in record[0] (e.g. Viewport),
+ // so guard before reaching string methods further down.
+ if (typeof value !== 'string' || value === '') {
return <></>
}