: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(insights): guard null series node in getDisplayNameFromEntityNode (#66646)
posthog[bot]b1a10bdc9565
diff --git a/frontend/src/scenes/insights/utils.test.ts b/frontend/src/scenes/insights/utils.test.tsindex 57ba61131a54..a5458ea40e1b 100644--- a/frontend/src/scenes/insights/utils.test.ts+++ b/frontend/src/scenes/insights/utils.test.ts@@ -101,6 +101,12 @@ describe('getDisplayNameFromEntityNode()', () => {})}})++ it('returns null instead of throwing when a series node is null', () => {+ // Malformed insight records can carry a null entry in query.series; the+ // function must not read `.id` off it (caught rendering the saved insights list).+ expect(getDisplayNameFromEntityNode(null as any)).toBeNull()+ })})describe('extractObjectDiffKeys()', () => {diff --git a/frontend/src/scenes/insights/utils.tsx b/frontend/src/scenes/insights/utils.tsxindex db89ba05411d..0da837549bd1 100644--- a/frontend/src/scenes/insights/utils.tsx+++ b/frontend/src/scenes/insights/utils.tsx@@ -144,7 +144,7 @@ export const getDisplayNameFromEntityNode = (? node.event: isGroupNode(node)? undefined- : node.id+ : node?.id// Return custom name. If that doesn't exist then the name, then the id, then just null.return (isCustom ? customName : null) ?? name ?? (id ? `${id}` : null)