diff --git a/frontend/src/lib/utils/getAppContext.ts b/frontend/src/lib/utils/getAppContext.ts index 22bf16a073e21..f937abcb690a0 100644 --- a/frontend/src/lib/utils/getAppContext.ts +++ b/frontend/src/lib/utils/getAppContext.ts @@ -16,6 +16,11 @@ export function getDefaultEventName(): string { return getAppContext()?.default_event_name || PathType.PageView } +export function getDefaultEventLabel(): string { + const name = getDefaultEventName() + return name === PathType.PageView ? 'Pageview' : name === PathType.Screen ? 'Screen' : name +} + // NOTE: Any changes to the teamId trigger a full page load so we don't use the logic // This helps avoid circular imports export function getCurrentTeamId(): TeamType['id'] { diff --git a/frontend/src/scenes/insights/filters/ActionFilter/entityFilterLogic.ts b/frontend/src/scenes/insights/filters/ActionFilter/entityFilterLogic.ts index 3bf18724e605b..510c572983499 100644 --- a/frontend/src/scenes/insights/filters/ActionFilter/entityFilterLogic.ts +++ b/frontend/src/scenes/insights/filters/ActionFilter/entityFilterLogic.ts @@ -2,7 +2,7 @@ import { actions, connect, events, kea, key, listeners, path, props, reducers, s import { convertPropertyGroupToProperties } from 'lib/components/PropertyFilters/utils' import { uuid } from 'lib/utils' import { eventUsageLogic, GraphSeriesAddedSource } from 'lib/utils/eventUsageLogic' -import { getDefaultEventName } from 'lib/utils/getAppContext' +import { getDefaultEventLabel, getDefaultEventName } from 'lib/utils/getAppContext' import { insightDataLogic } from 'scenes/insights/insightDataLogic' import { @@ -262,8 +262,9 @@ export const entityFilterLogic = kea([ const newLength = previousLength + 1 const precedingEntity = values.localFilters[previousLength - 1] as LocalFilter | undefined const order = precedingEntity ? precedingEntity.order + 1 : 0 - const newFilter = { + const newFilter: LocalFilter = { id: getDefaultEventName(), + name: getDefaultEventLabel(), uuid: uuid(), type: EntityTypes.EVENTS, order: order,