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): handle trend results without action metadata (#89868)

Sam Pennington14fb1e6a6f34
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 8801f2f4aba7..6dd054cc40db 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -7721,9 +7721,9 @@ snapshots:
scenes-app-posthog-ai-tools--dangerous-operation-pending-approval-long-content--light:
hash: v1.k794b7964.6557ac5b0fac9d1f226f12f944e08240e2913aef7d527c4b53a2017d6a7231aa.v61UHKqXj02ZfvDPrQtC2qsl4vPe0oPd98gpiaaQ_2Y
scenes-app-posthog-ai-tools--multi-visualization-in-thread--dark:
- hash: v1.k794b7964.e278289eb9de180c2b31995845077f34f05ee7bf66659add563eb8d7d7dc8592.uQvjAfNevwR7QvhINeSqaoNJKg0AUpWj3PY-P_ajaWg
+ hash: v1.k794b7964.6becd54faf97831df4f4a778c5e8de44acd297727ab9c1def058323cd071be33.PqDN2G62zNR4yAmnMU-xdjNsPU82m7BmBuYCveOsw6E
scenes-app-posthog-ai-tools--multi-visualization-in-thread--light:
- hash: v1.k794b7964.d6abb413fd77e00eb11393b237f4eeac0edc21baed3d33f727bc910d3c3c4536.0h8RhpILbz2mY4QxRc05ZsRPAIwEctZYFunYAmQscNc
+ hash: v1.k794b7964.7bd16ac554b0ef6a0f9abf8e8e7d5bc460369c2b0c3dd778776e4bf63ec97bc0.94NsDXj_srsigHAu8uGEMBlarn0ZQnIfJnyADZELmkM
scenes-app-posthog-ai-tools--notebook-artifact-markdown-only--dark:
hash: v1.k794b7964.153ef583b440b6078bd4d7c0fda71f34388699df02b964f464f82754b883f2d2.Th0lXC3c1DSCIyk2A7Di_YHPboZhWXtudWM0qHA5934
scenes-app-posthog-ai-tools--notebook-artifact-markdown-only--light:
diff --git a/frontend/src/scenes/insights/utils.test.ts b/frontend/src/scenes/insights/utils.test.ts
index ed44a28153b7..522c2e84a781 100644
--- a/frontend/src/scenes/insights/utils.test.ts
+++ b/frontend/src/scenes/insights/utils.test.ts
@@ -44,6 +44,10 @@ describe('getDisplayNameFromEntityFilter()', () => {
expect(getDisplayNameFromEntityFilter(filter, isCustom)).toEqual(expected)
})
})
+
+ it('returns null when a result has no action', () => {
+ expect(getDisplayNameFromEntityFilter(undefined)).toBeNull()
+ })
})
const createEventsNode = (id?: Entity['id'], name?: string, custom_name?: string): EventsNode => {
diff --git a/frontend/src/scenes/insights/utils.tsx b/frontend/src/scenes/insights/utils.tsx
index 296a94b36526..b2b1a8ac10a9 100644
--- a/frontend/src/scenes/insights/utils.tsx
+++ b/frontend/src/scenes/insights/utils.tsx
@@ -69,9 +69,9 @@ import {
import { insightLogic } from './insightLogic'
-export const isAllEventsEntityFilter = (filter: EntityFilter | ActionFilter | null): boolean => {
+export const isAllEventsEntityFilter = (filter: EntityFilter | ActionFilter | null | undefined): boolean => {
return (
- filter !== null &&
+ filter != null &&
filter.type === EntityTypes.EVENTS &&
filter.id === null &&
(!filter.name || filter.name === 'All events')
@@ -98,7 +98,7 @@ export const formatEventName = (name: string | undefined | null): string | undef
}
export const getDisplayNameFromEntityFilter = (
- filter: EntityFilter | ActionFilter | null,
+ filter: EntityFilter | ActionFilter | null | undefined,
isCustom = true
): string | null => {
// Make sure names aren't blank strings