Skip to content

Commit

Permalink
fix(insights): default event name (#21830)
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusandra authored Apr 25, 2024
1 parent 9576fab commit b14895a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions frontend/src/lib/utils/getAppContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -262,8 +262,9 @@ export const entityFilterLogic = kea<entityFilterLogicType>([
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,
Expand Down

0 comments on commit b14895a

Please sign in to comment.