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(insights): only load chart explanations with a valid id from the link (#130822)

Sam Penningtond24fbc451aea
diff --git a/products/product_analytics/frontend/insights/explainChart/explainChartLogic.ts b/products/product_analytics/frontend/insights/explainChart/explainChartLogic.ts
index fdaf861e9af7..6fbd351bf903 100644
--- a/products/product_analytics/frontend/insights/explainChart/explainChartLogic.ts
+++ b/products/product_analytics/frontend/insights/explainChart/explainChartLogic.ts
@@ -11,6 +11,7 @@ import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import type { FeatureFlagsSet } from 'lib/logic/featureFlagLogic'
import { getCurrentTeamId } from 'lib/utils/getAppContext'
+import { isUUIDLike } from 'lib/utils/guards'
import { insightDataLogic } from 'scenes/insights/insightDataLogic'
import { insightLogic } from 'scenes/insights/insightLogic'
import type { insightLogicValues } from 'scenes/insights/insightLogic'
@@ -588,7 +589,9 @@ export const explainChartLogic: LogicWrapper<explainChartLogicType> = kea<explai
urlToAction(({ actions, props }) => ({
'/insights/:shortId': ({ shortId }, { explanation }) => {
if (shortId === props.dashboardItemId) {
- actions.setLinkedExplanationId(typeof explanation === 'string' ? explanation : null)
+ actions.setLinkedExplanationId(
+ typeof explanation === 'string' && isUUIDLike(explanation) ? explanation : null
+ )
}
},
})),