Skip to content

Commit

Permalink
Simplify TS checks
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaeelaudibert committed Dec 5, 2024
1 parent c5a72df commit 0458f54
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions frontend/src/scenes/web-analytics/webAnalyticsLogic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1435,11 +1435,19 @@ export const webAnalyticsLogic = kea<webAnalyticsLogicType>([
): RecordingUniversalFilters => {
const filters: UniversalFiltersGroupValue[] = [...webAnalyticsFilters]
if (conversionGoal) {
const actionId = (conversionGoal as ActionConversionGoal).actionId
const customEventName = (conversionGoal as CustomEventConversionGoal).customEventName
const id = actionId || customEventName

filters.push({ id, name: String(id), type: customEventName ? 'events' : 'actions' })
if ('actionId' in conversionGoal) {
filters.push({
id: conversionGoal.actionId,
name: String(conversionGoal.actionId),
type: 'actions',
})
} else if ('customEventName' in conversionGoal) {
filters.push({
id: conversionGoal.customEventName,
name: conversionGoal.customEventName,
type: 'events',
})
}
}

return {
Expand Down

0 comments on commit 0458f54

Please sign in to comment.