: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(insights): commit pseudo-event picks from the new series picker (#58789)
Adam Leith000d92886f54
diff --git a/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/ActionFilterRow.tsx b/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/ActionFilterRow.tsxindex 09ebe529a733..7b64fd9524d5 100644--- a/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/ActionFilterRow.tsx+++ b/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/ActionFilterRow.tsx@@ -202,6 +202,95 @@ export function ActionFilterRow({[updateFilterProperty, index])+ /**+ * Shared selection handler for both the legacy `TaxonomicPopover` and the+ * new `TaxonomicFilterMenu` / `TaxonomicAutocomplete`. The pseudo-event+ * groups (Pageview / Screen / Autocapture events) and quick filters don't+ * map to a plain `EntityType` — they expand into a base event plus a+ * property filter. Keeping one handler guarantees the new picker behaves+ * identically to the legacy one.+ */+ const applyTaxonomicSelection = useCallback(+ (+ taxonomicGroupType: TaxonomicFilterGroupType,+ changedValue: string | number | null | undefined,+ item: any+ ): void => {+ if (isQuickFilterItem(item)) {+ if (item.eventName) {+ updateFilter({ type: EntityTypes.EVENTS, id: item.eventName, name: item.eventName, index })+ }+ updateFilterProperty({ index, properties: quickFilterToPropertyFilters(item) })+ return+ }+ if (taxonomicGroupType === TaxonomicFilterGroupType.PageviewEvents) {+ updateFilter({ type: EntityTypes.EVENTS, id: '$pageview', name: '$pageview', index })+ updateFilterProperty({+ index,+ properties: [+ {+ key: '$current_url',+ value: changedValue ? String(changedValue) : '',+ operator: PropertyOperator.IContains,+ type: PropertyFilterType.Event,+ },+ ],+ })+ return+ }+ if (taxonomicGroupType === TaxonomicFilterGroupType.ScreenEvents) {+ updateFilter({ type: EntityTypes.EVENTS, id: '$screen', name: '$screen', index })+ updateFilterProperty({+ index,+ properties: [+ {+ key: '$screen_name',+ value: changedValue ? String(changedValue) : '',+ operator: PropertyOperator.Exact,+ type: PropertyFilterType.Event,+ },+ ],+ })+ return+ }+ if (taxonomicGroupType === TaxonomicFilterGroupType.AutocaptureEvents) {+ updateFilter({ type: EntityTypes.EVENTS, id: '$autocapture', name: '$autocapture', index })+ updateFilterProperty({+ index,+ properties: [+ {+ key: '$el_text',+ value: changedValue ? String(changedValue) : '',+ operator: PropertyOperator.Exact,+ type: PropertyFilterType.Event,+ },+ ],+ })+ return+ }+ const groupType = taxonomicFilterGroupTypeToEntityType(taxonomicGroupType)+ if (groupType === EntityTypes.DATA_WAREHOUSE) {+ const extraValues = Object.fromEntries(dataWarehousePopoverFields.map(({ key }) => [key, item?.[key]]))+ updateFilter({+ type: groupType,+ id: changedValue ? String(changedValue) : null,+ name: item?.name ?? '',+ table_name: item?.name,+ index,+ ...extraValues,+ })+ } else {+ updateFilter({+ type: groupType || undefined,+ id: changedValue ? String(changedValue) : null,+ name: item?.name ?? '',+ index,+ })+ }+ },+ [updateFilter, updateFilterProperty, index, dataWarehousePopoverFields]+ )+const onMathSelect = (_: unknown, selectedMath?: string): void => {let mathPropertiesif (selectedMath) {@@ -291,104 +380,9 @@ export function ActionFilterRow({suggestedFiltersLabel={suggestedFiltersLabel}enableKeywordShortcutsselectingKeyOnly- onChange={(changedValue, taxonomicGroupType, item) => {- if (isQuickFilterItem(item)) {- if (item.eventName) {- updateFilter({- type: EntityTypes.EVENTS,- id: item.eventName,- name: item.eventName,- index,- })- }- updateFilterProperty({- index,- properties: quickFilterToPropertyFilters(item),- })- return- }- if (taxonomicGroupType === TaxonomicFilterGroupType.PageviewEvents) {- updateFilter({- type: EntityTypes.EVENTS,- id: '$pageview',- name: '$pageview',- index,- })- updateFilterProperty({- index,- properties: [- {- key: '$current_url',- value: changedValue ? String(changedValue) : '',- operator: PropertyOperator.IContains,- type: PropertyFilterType.Event,- },- ],- })- return- }- if (taxonomicGroupType === TaxonomicFilterGroupType.ScreenEvents) {- updateFilter({- type: EntityTypes.EVENTS,- id: '$screen',- name: '$screen',- index,- })- updateFilterProperty({- index,- properties: [- {- key: '$screen_name',- value: changedValue ? String(changedValue) : '',- operator: PropertyOperator.Exact,- type: PropertyFilterType.Event,- },- ],- })- return- }- if (taxonomicGroupType === TaxonomicFilterGroupType.AutocaptureEvents) {- updateFilter({- type: EntityTypes.EVENTS,- id: '$autocapture',- name: '$autocapture',- index,- })- updateFilterProperty({- index,- properties: [- {- key: '$el_text',- value: changedValue ? String(changedValue) : '',- operator: PropertyOperator.Exact,- type: PropertyFilterType.Event,- },- ],- })- return- }- const groupType = taxonomicFilterGroupTypeToEntityType(taxonomicGroupType)- if (groupType === EntityTypes.DATA_WAREHOUSE) {- const extraValues = Object.fromEntries(- dataWarehousePopoverFields.map(({ key }) => [key, item?.[key]])- )- updateFilter({- type: groupType,- id: changedValue ? String(changedValue) : null,- name: item?.name ?? '',- table_name: item?.name,- index,- ...extraValues,- })- } else {- updateFilter({- type: groupType || undefined,- id: changedValue ? String(changedValue) : null,- name: item?.name ?? '',- index,- })- }- }}+ onChange={(changedValue, taxonomicGroupType, item) =>+ applyTaxonomicSelection(taxonomicGroupType, changedValue, item)+ }renderValue={() => <EntityFilterInfo filter={filter} showIcon />}groupTypes={effectiveActionsTaxonomicGroupTypes}placeholder="All events"@@ -587,18 +581,9 @@ export function ActionFilterRow({// here, and traps Tab off the trigger.bindRootProps={false}taxonomicGroupTypes={effectiveActionsTaxonomicGroupTypes}- onChange={(group, changedValue, item) => {- const groupType = taxonomicFilterGroupTypeToEntityType(group.type)- if (!groupType) {- return- }- updateFilter({- type: groupType,- id: changedValue ? String(changedValue) : null,- name: item?.name ?? '',- index,- })- }}+ onChange={(group, changedValue, item) =>+ applyTaxonomicSelection(group.type, changedValue, item)+ }>{useMenuRebuild ? (<TaxonomicFilterMenu