: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(replay): don't flag "All events" as unusable in recordings filters (#70100)
Arno Hillen0f0ed7c065a2
diff --git a/frontend/src/scenes/session-recordings/playlist/sessionRecordingsPlaylistLogic.test.ts b/frontend/src/scenes/session-recordings/playlist/sessionRecordingsPlaylistLogic.test.tsindex 9757c4c54ac0..4e87869c442d 100644--- a/frontend/src/scenes/session-recordings/playlist/sessionRecordingsPlaylistLogic.test.ts+++ b/frontend/src/scenes/session-recordings/playlist/sessionRecordingsPlaylistLogic.test.ts@@ -85,7 +85,10 @@ describe('sessionRecordingsPlaylistLogic', () => {],},- 'api/projects/:team/property_definitions/seen_together': { $pageview: true },+ '/api/projects/:team_id/property_definitions/seen_together': ({ request }) => {+ const eventNames = new URL(request.url).searchParams.getAll('event_names')+ return [200, Object.fromEntries(eventNames.map((name) => [name, name === '$pageview']))]+ },'/api/environments/:team_id/session_recordings': ({ request }) => {const { searchParams } = new URL(request.url)@@ -451,6 +454,39 @@ describe('sessionRecordingsPlaylistLogic', () => {})})+ describe('unusableEventsInFilter', () => {+ // the "All events" pseudo-entity has no id and matches any event, so it must never be+ // flagged as unusable (the group page pins it, so flagging it breaks every group page)+ const allEventsFilter = {+ name: 'All events',+ type: 'events',+ properties: [{ key: "$group_0 = 'test'", type: PropertyFilterType.HogQL }],+ } as ActionFilter+ const unseenEventFilter = { id: 'backend_event', name: 'backend_event', type: 'events' } as ActionFilter++ it.each<[string, ActionFilter[], string[]]>([+ ['only "All events"', [allEventsFilter], []],+ [+ '"All events" plus an event without $session_id',+ [allEventsFilter, unseenEventFilter],+ ['backend_event'],+ ],+ ])('flags no pseudo-entities when filtering by %s', async (_, eventFilters, expected) => {+ await expectLogic(logic, () => {+ logic.actions.setFilters({+ filter_group: {+ type: FilterLogicalOperator.And,+ values: [{ type: FilterLogicalOperator.And, values: eventFilters }],+ },+ })+ })+ .toDispatchActions(['loadEventsHaveSessionIdSuccess'])+ .toMatchValues({+ unusableEventsInFilter: expected,+ })+ })+ })+describe('date range', () => {it('is set by setFilters and fetches results from server and sets the url', async () => {await expectLogic(logic, () => {diff --git a/frontend/src/scenes/session-recordings/playlist/sessionRecordingsPlaylistLogic.ts b/frontend/src/scenes/session-recordings/playlist/sessionRecordingsPlaylistLogic.tsindex 40907ae11eb1..eaab42021f76 100644--- a/frontend/src/scenes/session-recordings/playlist/sessionRecordingsPlaylistLogic.ts+++ b/frontend/src/scenes/session-recordings/playlist/sessionRecordingsPlaylistLogic.ts@@ -504,7 +504,10 @@ export const sessionRecordingsPlaylistLogic = kea<sessionRecordingsPlaylistLogic{loadEventsHaveSessionId: async () => {const filters = filtersFromUniversalFilterGroups(values.filters)- const events: FilterType['events'] = filters.filter(isEventFilter)+ // "All events" (id == null) matches any event, so it can always filter recordings+ const events: FilterType['events'] = filters+ .filter(isEventFilter)+ .filter((event) => event.id != null)if (events === undefined || events.length === 0) {return {}