: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
feat(insights): reveal underlying event for renamed series (#71902)
Paul D'Ambra7b102095ba06
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 203aced86c7f..8a6dcc56b119 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -408,6 +408,10 @@ snapshots:hash: v1.k794b7964.b98036b313efce67327df1499b6583b55f482ca3aca5320b255280d601bab8f6.VSqEn95sY0Q1aSYbP1-TlEXjQMJqBJDyo8KouaEHpnAcomponents-empty-message--empty-message--light:hash: v1.k794b7964.e239200ef2774fea73cb9184a4e09a434a505e8ab0cbdbcb139fed4fd18b642a.MKSKgTxAUa8WJ6jCYqsmAgVjewd4zhd5-57EoL0kkdA+ components-entity-filter-info--renamed-and-unrenamed-series--dark:+ hash: v1.k794b7964.bea8ab7e39a8364ee26cc117d93a1c4c8a9d6aee90928113f5fd507a60f9d399.oqTYgnhSacabZyhWq8SDsXiQpaJXzWriZDi1y1XQk0w+ components-entity-filter-info--renamed-and-unrenamed-series--light:+ hash: v1.k794b7964.ca3a8526ed0f7eee16a57c00f6ff34c17e75dd87642df8ec00a82036aca1f888.VtepH22TkcZm4dNfLA3NUjfX4s-z36MVDpovsBDrBn4components-errors-collapsibleframe--in-app-with-context--dark:hash: v1.k794b7964.c71f4f4f70ea6851827952555de9223ebccd3cb954ee52cef2c24d79ccc5def1.aJec42PZy344JWQ397gVN3cE0B7v_uDHu0lB9b1Dgg0components-errors-collapsibleframe--in-app-with-context--light:@@ -2516,6 +2520,14 @@ snapshots:hash: v1.k794b7964.aa34b04cf14ce8e95422fcf1c2dd76ac83b04eac3e6c6d5326dbce7eee4d0f11.XXsKHQ9DntH3SiWm0zeEz4W6r0Uj9VxqAtxK1LRC4Uofilters-taxonomic-filter--properties--light:hash: v1.k794b7964.f0a0b723b949646469217e024a4e6e6ae850a8e1aab2ecb9fdc8aa01c91fe37b.zvxvcSMTj0228nQgbDWGPKnQnEnZriSgYqSXHsS4uow+ filters-taxonomic-filter--renamed-series-selected--dark:+ hash: v1.k794b7964.0f43082ba1cb865c32f473d147c4ede342b7bf53d1b039c681f97a807e17445b.jXiNWtKVehE9y7ywzmPdvN546SxtUy_A83SvC3Idenc+ filters-taxonomic-filter--renamed-series-selected--light:+ hash: v1.k794b7964.6684b93a7843cac1e5699419888add7e2b0836e989a128aae9babfcdbdd82ee1.AC22dkpHisYnGsCe3-uoULr_Lq4ZDf7RCCLEXqrhzN8+ filters-taxonomic-filter--renamed-series-selected-pill--dark:+ hash: v1.k794b7964.f324e609972c699f2e82410b2735ba3df783c180d41d8b0f6b2fbae6cf342dfd.WH8jdaWQlhPTrvYCLz20rVFKxXE1PcvC_no3CBzKWAY+ filters-taxonomic-filter--renamed-series-selected-pill--light:+ hash: v1.k794b7964.081cb668eba79e99e3431a23818f51d1921a3247f039c7fe96df0388aa6d54b4.EJke3lDofVcwrAlGtGomXBkJCTicCGW2H5cbISKnGm0filters-taxonomic-filter--six-groups-default-layout--dark:hash: v1.k794b7964.6720b50c7ba8f3918a8c142a86467b7a910a5c6f0d88d49ca8042afbf628877e.I5xU7-YqIfvND-ac2n3lc_kN5TEraGL5oLW-VNPkmcIfilters-taxonomic-filter--six-groups-default-layout--light:diff --git a/frontend/src/lib/components/EntityFilterInfo.stories.tsx b/frontend/src/lib/components/EntityFilterInfo.stories.tsxnew file mode 100644index 000000000000..149c62a5cdd3--- /dev/null+++ b/frontend/src/lib/components/EntityFilterInfo.stories.tsx@@ -0,0 +1,68 @@+import { Meta, StoryObj } from '@storybook/react'++import { ActionFilter, EntityFilter, EntityTypes } from '~/types'++import { EntityFilterInfo } from './EntityFilterInfo'++const meta: Meta<typeof EntityFilterInfo> = {+ title: 'Components/Entity Filter Info',+ component: EntityFilterInfo,+ parameters: {+ docs: {+ description: {+ component:+ 'Renders an insight series label. When the series is renamed (via `custom_name`, or a `name` set through the API) the label alone hides what the series queries, so the underlying entity is revealed as secondary text plus an "Event sent as …" tooltip on hover.',+ },+ },+ },+ tags: ['autodocs'],+}+export default meta+type Story = StoryObj<typeof EntityFilterInfo>++const VARIANTS: { label: string; filter: EntityFilter | ActionFilter }[] = [+ {+ label: 'Unrenamed core event (single label, no tooltip)',+ filter: { type: EntityTypes.EVENTS, id: '$pageview', name: '$pageview' },+ },+ {+ label: 'Unrenamed custom event',+ filter: { type: EntityTypes.EVENTS, id: 'signed up', name: 'signed up' },+ },+ {+ label: 'Renamed via custom name — hover for the tooltip',+ filter: { type: EntityTypes.EVENTS, id: 'signed up', name: 'signed up', custom_name: 'Completed sign-up' },+ },+ {+ label: 'Renamed via name (set through the API) — hover for the tooltip',+ filter: { type: EntityTypes.EVENTS, id: '$pageview', name: 'Visited posthog.com' },+ },+ {+ label: 'Renamed action — hover for the tooltip',+ filter: { type: EntityTypes.ACTIONS, id: 5, name: 'Completed purchase', custom_name: 'Checkout' },+ },+ {+ label: 'Renamed all-events series',+ filter: { type: EntityTypes.EVENTS, id: null, name: 'All events', custom_name: 'Total traffic' },+ },+]++export const RenamedAndUnrenamedSeries: Story = {+ render: () => (+ <div className="flex flex-col gap-2 max-w-2xl">+ {VARIANTS.map(({ label, filter }) => (+ <div key={label} className="flex items-center gap-4 border rounded p-2 bg-surface-primary">+ <span className="text-xs text-secondary w-80 shrink-0">{label}</span>+ <EntityFilterInfo filter={filter} />+ </div>+ ))}+ </div>+ ),+ parameters: {+ docs: {+ description: {+ story: 'Renamed series show the underlying entity as secondary text; hovering the label opens a tooltip with the raw key ("Event sent as `signed up`"). Unrenamed series keep a single plain label with no tooltip.',+ },+ },+ },+}diff --git a/frontend/src/lib/components/EntityFilterInfo.test.tsx b/frontend/src/lib/components/EntityFilterInfo.test.tsxnew file mode 100644index 000000000000..8f996aed664f--- /dev/null+++ b/frontend/src/lib/components/EntityFilterInfo.test.tsx@@ -0,0 +1,91 @@+import '@testing-library/jest-dom'++import { cleanup, render, screen } from '@testing-library/react'+import userEvent from '@testing-library/user-event'++import { initKeaTests } from '~/test/init'+import { ActionFilter, EntityFilter, EntityTypes } from '~/types'++import { EntityFilterInfo } from './EntityFilterInfo'++describe('EntityFilterInfo', () => {+ beforeEach(() => {+ initKeaTests()+ })++ afterEach(cleanup)++ // A series can be renamed via `custom_name`, or via `name` (e.g. set through the API).+ // In both cases the label alone doesn't reveal the event actually queried, so the+ // underlying event must be shown alongside it.+ it.each([+ [+ 'custom_name matching name',+ { type: EntityTypes.EVENTS, id: 'user signed up', name: 'Signed up', custom_name: 'Signed up' },+ 'Signed up',+ 'user signed up',+ ],+ [+ 'name only',+ { type: EntityTypes.EVENTS, id: '$pageview', name: 'Visited posthog.com' },+ 'Visited posthog.com',+ 'Pageview',+ ],+ [+ 'custom_name on an action',+ { type: EntityTypes.ACTIONS, id: 5, name: 'Completed purchase', custom_name: 'Checkout' },+ 'Checkout',+ 'Completed purchase',+ ],+ [+ 'custom_name on an all-events series',+ { type: EntityTypes.EVENTS, id: null, name: 'All events', custom_name: 'Total traffic' },+ 'Total traffic',+ 'All events',+ ],+ ] as [string, EntityFilter | ActionFilter, string, string][])(+ 'shows the underlying entity next to a series renamed via %s',+ (_, filter, label, underlying) => {+ render(<EntityFilterInfo filter={filter} />)+ expect(screen.getByText(label)).toBeInTheDocument()+ expect(screen.getByText(underlying)).toBeInTheDocument()+ }+ )++ it.each([+ [+ 'a custom event',+ { type: EntityTypes.EVENTS, id: 'user signed up', name: 'user signed up' },+ 'user signed up',+ ],+ ['a core event', { type: EntityTypes.EVENTS, id: '$pageview', name: '$pageview' }, 'Pageview'],+ // API-created series often carry no name at all — the raw id label is not a rename+ ['a name-less core event', { type: EntityTypes.EVENTS, id: '$pageview' }, '$pageview'],+ ['an all-events series', { type: EntityTypes.EVENTS, id: null, name: 'All events' }, 'All events'],+ ] as [string, EntityFilter, string][])('shows a single label for an unrenamed series on %s', (_, filter, label) => {+ const { container } = render(<EntityFilterInfo filter={filter} />)+ expect(screen.getAllByText(label)).toHaveLength(1)+ expect(container.querySelectorAll('.EntityFilterInfo')).toHaveLength(1)+ })++ it('keeps the underlying entity out of the inline label when showSingleName is set', () => {+ const { container } = render(+ <EntityFilterInfo+ filter={{ type: EntityTypes.EVENTS, id: 'user signed up', name: 'Signed up', custom_name: 'Signed up' }}+ showSingleName+ />+ )+ expect(container).toHaveTextContent('Signed up')+ expect(container).not.toHaveTextContent('user signed up')+ })++ it('reveals the raw event key in the tooltip of a renamed series', async () => {+ render(+ <EntityFilterInfo+ filter={{ type: EntityTypes.EVENTS, id: 'user signed up', name: 'Signed up', custom_name: 'Signed up' }}+ />+ )+ userEvent.hover(screen.getByText('Signed up'))+ expect(await screen.findByText(/Event sent as/, {}, { timeout: 3000 })).toBeInTheDocument()+ })+})diff --git a/frontend/src/lib/components/EntityFilterInfo.tsx b/frontend/src/lib/components/EntityFilterInfo.tsxindex 8ea91287c96d..4229f2886b53 100644--- a/frontend/src/lib/components/EntityFilterInfo.tsx+++ b/frontend/src/lib/components/EntityFilterInfo.tsx@@ -1,13 +1,138 @@import clsx from 'clsx'+import { Tooltip } from 'lib/lemon-ui/Tooltip'+import { ensureStringIsNotBlank } from 'lib/utils/strings'import { getEventDefinitionIcon } from 'scenes/data-management/events/DefinitionHeader'-import { getDisplayNameFromEntityFilter, isAllEventsEntityFilter } from 'scenes/insights/utils'+import { formatEventName, getDisplayNameFromEntityFilter, isAllEventsEntityFilter } from 'scenes/insights/utils'import { getCoreFilterDefinition } from '~/taxonomy/helpers'import { ActionFilter, EntityFilter, EntityTypes } from '~/types'import { TaxonomicFilterGroupType } from './TaxonomicFilter/types'+interface UnderlyingEntity {+ /** The raw key the filter queries: event name as sent, action name, or table name. */+ raw: string+ /** Human-readable form of the raw key (core event labels applied). */+ display: string+ kind: 'event' | 'events' | 'action' | 'data warehouse table'+}++/**+ * The concrete thing a series filter queries, independent of any renames on the series.+ * A series can be renamed via `custom_name` or by overriding `name` directly (e.g. via the+ * API), so neither of those fields reliably reveals what is actually being queried.+ */+function getUnderlyingEntity(filter: EntityFilter | ActionFilter): UnderlyingEntity | null {+ if (filter.type === EntityTypes.ACTIONS) {+ const raw = ensureStringIsNotBlank(filter.name) ?? (filter.id != null ? String(filter.id) : null)+ return raw ? { raw, display: raw, kind: 'action' } : null+ }+ if (filter.type === EntityTypes.DATA_WAREHOUSE) {+ const tableName =+ 'table_name' in filter && typeof filter.table_name === 'string'+ ? ensureStringIsNotBlank(filter.table_name)+ : null+ const raw = tableName ?? (typeof filter.id === 'string' ? ensureStringIsNotBlank(filter.id) : null)+ return raw ? { raw, display: raw, kind: 'data warehouse table' } : null+ }+ if (filter.type === EntityTypes.GROUPS) {+ // Inline event groups hold their comma-separated event keys in `name`+ const raw = ensureStringIsNotBlank(filter.name)+ return raw ? { raw, display: formatEventName(raw) ?? raw, kind: raw.includes(',') ? 'events' : 'event' } : null+ }+ // Events — filters without an explicit type are events by convention+ if (typeof filter.id === 'string' && filter.id) {+ return { raw: filter.id, display: formatEventName(filter.id) ?? filter.id, kind: 'event' }+ }+ return null+}++interface EntityFilterDisplayInfo {+ /** The label users see for the series: `custom_name`, falling back to `name`/`id`. */+ displayName?: string+ /** The non-custom label (`name`/`id`) — the reveal for renamed series without a+ * single underlying key (an all-events series). */+ baseName?: string+ underlying: UnderlyingEntity | null+ /** True when the label alone doesn't reveal the underlying entity. */+ isRenamed: boolean+}++function getEntityFilterDisplayInfo(+ filter: EntityFilter | ActionFilter,+ filterGroupType?: TaxonomicFilterGroupType+): EntityFilterDisplayInfo {+ let name: string | undefined+ if (isAllEventsEntityFilter(filter) && !filter?.custom_name) {+ name = 'All events'+ } else {+ const raw = getDisplayNameFromEntityFilter(filter, false)+ name =+ (filterGroupType ? getCoreFilterDefinition(raw, filterGroupType)?.label?.trim() : null) ?? raw ?? undefined+ }+ const customName = filter?.custom_name ? (getDisplayNameFromEntityFilter(filter, true) ?? undefined) : undefined+ const displayName = customName ?? name+ const underlying = getUnderlyingEntity(filter)+ return {+ displayName,+ baseName: name,+ underlying,+ // A label equal to either form of the underlying key already reveals it — e.g. a+ // name-less `$pageview` series displays the raw key itself, so it isn't a rename.+ isRenamed:+ !!displayName && !!underlying && underlying.display !== displayName && underlying.raw !== displayName,+ }+}++export interface SeriesRename {+ /** The label users see for the series. */+ label: string+ /** The raw key the series actually queries. */+ raw: string+}++/**+ * The rename a series carries, when its label hides the thing it queries — the pickers+ * use it to label the committed selection like the series the user clicked. Data+ * warehouse series keep their own committed-selection affordance, so they never report one.+ */+export function getSeriesRename(filter: EntityFilter | ActionFilter | null | undefined): SeriesRename | null {+ if (!filter || filter.type === EntityTypes.DATA_WAREHOUSE) {+ return null+ }+ const { displayName, underlying, isRenamed } = getEntityFilterDisplayInfo(filter)+ return isRenamed && displayName && underlying ? { label: displayName, raw: underlying.raw } : null+}++function EntityFilterInfoTooltipTitle({+ displayName,+ underlying,+}: {+ displayName: string+ underlying: UnderlyingEntity | null+}): JSX.Element {+ return (+ <div className="flex flex-col gap-0.5">+ <span className="font-semibold">{displayName}</span>+ {underlying &&+ underlying.raw !== displayName &&+ (underlying.kind === 'event' || underlying.kind === 'events' ? (+ <span>+ {underlying.kind === 'events' ? 'Events sent as' : 'Event sent as'}{' '}+ <code>{underlying.raw}</code>+ </span>+ ) : underlying.kind === 'action' ? (+ <span>Action: {underlying.raw}</span>+ ) : (+ <span>+ Data warehouse table: <code>{underlying.raw}</code>+ </span>+ ))}+ </div>+ )+}+interface EntityFilterInfoProps {filter: EntityFilter | ActionFilterallowWrap?: boolean@@ -30,16 +155,17 @@ export function EntityFilterInfo({showIcon = false,}: EntityFilterInfoProps): JSX.Element {const isColumn = layout === 'column'- let name: string | undefined- if (isAllEventsEntityFilter(filter) && !filter?.custom_name) {- name = 'All events'- } else {- const raw = getDisplayNameFromEntityFilter(filter, false)- name =- (filterGroupType ? getCoreFilterDefinition(raw, filterGroupType)?.label?.trim() : null) ?? raw ?? undefined- }+ const { displayName, baseName, underlying, isRenamed } = getEntityFilterDisplayInfo(filter, filterGroupType)- const customName = filter?.custom_name ? (getDisplayNameFromEntityFilter(filter, true) ?? undefined) : undefined+ // Reveal the underlying entity (and the tooltip) only when the label hides it — an+ // unrenamed series keeps a single plain label. A renamed series without a single+ // underlying key (an all-events series) falls back to revealing its base name.+ const underlyingName = isRenamed+ ? underlying?.display+ : filter?.custom_name && baseName && baseName !== displayName+ ? baseName+ : undefined+ const showTooltip = isRenamedconst icon = showIcon? getEventDefinitionIcon({@@ -50,7 +176,7 @@ export function EntityFilterInfo({}): null- return (+ const content = (// eslint-disable-next-line react/forbid-dom-props<spanclassName={clsx(@@ -64,9 +190,9 @@ export function EntityFilterInfo({{icon}<spanclassName={clsx('EntityFilterInfo max-w-full', !allowWrap && 'whitespace-nowrap truncate')}- title={customName ?? name}+ title={showTooltip ? undefined : displayName}>- {customName ?? name}+ {displayName}</span></span>{isOptional && (@@ -74,18 +200,27 @@ export function EntityFilterInfo({(optional)</span>)}- {customName && !showSingleName && (+ {underlyingName && !showSingleName && (<spanclassName={clsx('EntityFilterInfo max-w-full text-secondary text-xs',isColumn ? (icon ? 'ml-5' : '') : 'ml-1',!allowWrap && 'whitespace-nowrap truncate')}- title={name}+ title={showTooltip ? undefined : underlyingName}>- {name}+ {underlyingName}</span>)}</span>)++ if (!showTooltip || !displayName) {+ return content+ }+ return (+ <Tooltip title={<EntityFilterInfoTooltipTitle displayName={displayName} underlying={underlying} />}>+ {content}+ </Tooltip>+ )}diff --git a/frontend/src/lib/components/TaxonomicFilter/InfiniteList.tsx b/frontend/src/lib/components/TaxonomicFilter/InfiniteList.tsxindex 26fac931aaf8..a799623aa027 100644--- a/frontend/src/lib/components/TaxonomicFilter/InfiniteList.tsx+++ b/frontend/src/lib/components/TaxonomicFilter/InfiniteList.tsx@@ -12,6 +12,7 @@ import { LemonButton, LemonDivider, LemonTag } from '@posthog/lemon-ui'import { AutoSizer } from 'lib/components/AutoSizer'import { ControlledDefinitionPopover } from 'lib/components/DefinitionPopover/DefinitionPopoverContents'import { definitionPopoverLogic } from 'lib/components/DefinitionPopover/definitionPopoverLogic'+import { EntityFilterInfo, getSeriesRename } from 'lib/components/EntityFilterInfo'import { formatPropertyLabel } from 'lib/components/PropertyFilters/utils'import { PropertyKeyInfo } from 'lib/components/PropertyKeyInfo'import { AUTOCAPTURE_INTERACTIONS } from 'lib/components/TaxonomicFilter/eventTypeShortcuts'@@ -41,7 +42,7 @@ import { eventUsageLogic } from 'lib/utils/eventUsageLogic'import { pluralize } from 'lib/utils/strings'import { getCoreFilterDefinition } from '~/taxonomy/helpers'-import { EventDefinition, PropertyDefinition } from '~/types'+import { EntityFilter, EventDefinition, PropertyDefinition } from '~/types'import { NO_ITEM_SELECTED, infiniteListLogic } from './infiniteListLogic'@@ -158,18 +159,54 @@ const unusedIndicator = (eventNames: string[]): JSX.Element => {)}+/**+ * A renamed series doesn't reveal the thing it queries, so when a row is the committed+ * selection of a renamed series, its label is the series' display name (with the+ * underlying entity as secondary text + tooltip) — connecting the row to the series+ * the user clicked.+ */+const getSelectedItemRenameMeta = (+ selectedItemMeta: EntityFilter | null | undefined,+ itemValue: string | number | null | undefined+): EntityFilter | null => {+ if (+ !selectedItemMeta ||+ selectedItemMeta.id == null ||+ itemValue == null ||+ String(selectedItemMeta.id) !== String(itemValue)+ ) {+ return null+ }+ return getSeriesRename(selectedItemMeta) ? selectedItemMeta : null+}++const rowContentsIcon = (+ item: TaxonomicDefinitionTypes,+ itemGroup: TaxonomicFilterGroup,+ isActive: boolean+): JSX.Element | null =>+ isActive ? (+ <div className="taxonomic-list-row-contents-icon">+ <IconCheck />+ </div>+ ) : itemGroup.getIcon ? (+ <div className="taxonomic-list-row-contents-icon">{itemGroup.getIcon(item)}</div>+ ) : null+const renderItemContents = ({item,listGroupType,itemGroup,eventNames,isActive,+ selectedRenameMeta,}: {item: TaxonomicDefinitionTypeslistGroupType: TaxonomicFilterGroupTypeitemGroup: TaxonomicFilterGroupeventNames: string[]isActive: boolean+ selectedRenameMeta?: EntityFilter | null}): JSX.Element | string => {if (isQuickFilterItem(item)) {const icon = itemGroup.getIcon ? (@@ -187,14 +224,16 @@ const renderItemContents = ({</div>)}- if (hasLocalListContext(item)) {- const icon = isActive ? (- <div className="taxonomic-list-row-contents-icon">- <IconCheck />+ if (selectedRenameMeta) {+ return (+ <div className="taxonomic-list-row-contents min-w-0">+ {rowContentsIcon(item, itemGroup, isActive)}+ <EntityFilterInfo filter={selectedRenameMeta} /></div>- ) : itemGroup.getIcon ? (- <div className="taxonomic-list-row-contents-icon">{itemGroup.getIcon(item)}</div>- ) : null+ )+ }+ if (hasLocalListContext(item)) {+ const icon = rowContentsIcon(item, itemGroup, isActive)if (hasRecentContext(item) && item._recentContext.propertyFilter) {const label = formatPropertyLabel(item._recentContext.propertyFilter, {})@@ -230,13 +269,7 @@ const renderItemContents = ({(item as PropertyDefinition).is_seen_on_filtered_events !== null &&!(item as PropertyDefinition).is_seen_on_filtered_events- const icon = isActive ? (- <div className="taxonomic-list-row-contents-icon">- <IconCheck />- </div>- ) : itemGroup.getIcon ? (- <div className="taxonomic-list-row-contents-icon">{itemGroup.getIcon(item)}</div>- ) : null+ const icon = rowContentsIcon(item, itemGroup, isActive)return listGroupType === TaxonomicFilterGroupType.EventProperties ||listGroupType === TaxonomicFilterGroupType.EventFeatureFlags ||@@ -337,6 +370,7 @@ interface InfiniteListRowProps {groupType: TaxonomicFilterGroupType | undefinedvalue: string | number | null | undefinedselectedProperties: TaxonomicFilterGroupValueMap+ selectedItemMeta: EntityFilter | null | undefinedeventNames: string[]highlightedIndex: numberisActiveTab: boolean@@ -403,6 +437,7 @@ export const InfiniteListRow = ({groupType,value,selectedProperties,+ selectedItemMeta,eventNames,highlightedIndex,isActiveTab,@@ -600,6 +635,7 @@ export const InfiniteListRow = ({itemGroup: resolvedItemGroup,eventNames,isActive,+ selectedRenameMeta: isSelected ? getSelectedItemRenameMeta(selectedItemMeta, itemValue) : null,})}{isCrossGroupItem && (<LemonTag size="small" type="highlight">@@ -872,6 +908,7 @@ export function InfiniteList({ popupAnchorElement, definitionPopoverRenderer }:groupType,value,selectedProperties,+ selectedItemMeta,eventNames,highlightedIndex: index,isActiveTab,diff --git a/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.stories.tsx b/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.stories.tsxindex 77005d40943d..ca08fd79e985 100644--- a/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.stories.tsx+++ b/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.stories.tsx@@ -14,7 +14,7 @@ import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { mswDecorator } from '~/mocks/browser'import { useAvailableFeatures } from '~/mocks/features'import { actionsModel } from '~/models/actionsModel'-import { type AnyPropertyFilter, AvailableFeature, PropertyFilterType, PropertyOperator } from '~/types'+import { type AnyPropertyFilter, AvailableFeature, EntityTypes, PropertyFilterType, PropertyOperator } from '~/types'import { infiniteListLogic } from './infiniteListLogic'import { recentTaxonomicFiltersLogic } from './recentTaxonomicFiltersLogic'@@ -533,6 +533,76 @@ export const CategoryDropdownPill: Story = {},}+// The committed selection of a renamed series ('signed up', renamed "Completed sign-up")+// is promoted to the top of the list, labelled with the rename and revealing the+// underlying event as secondary text (tooltip on hover).+const RENAMED_SERIES_ARGS: TaxonomicFilterProps = {+ groupType: TaxonomicFilterGroupType.Events,+ value: 'signed up',+ filter: {+ type: EntityTypes.EVENTS,+ id: 'signed up',+ name: 'signed up',+ custom_name: 'Completed sign-up',+ order: 0,+ },+ taxonomicGroupTypes: [TaxonomicFilterGroupType.Events, TaxonomicFilterGroupType.Actions],+}++const RENAMED_SERIES_PARAMETERS = {+ // Wait on the promoted renamed row itself: the picker also mounts hidden, empty+ // Recent/Pinned lists ahead of the active Events list, and the test runner waits on+ // the FIRST `.taxonomic-infinite-list` match — which never becomes visible.+ testOptions: { waitForSelector: '.taxonomic-list-row .EntityFilterInfo' },+}++export const RenamedSeriesSelected: Story = {+ render: (args) => {+ useMountedLogic(actionsModel)+ return (+ <div className="w-fit border rounded p-2 bg-surface-primary">+ <TaxonomicFilter {...args} />+ </div>+ )+ },+ args: {+ ...RENAMED_SERIES_ARGS,+ taxonomicFilterLogicKey: 'renamed-series-selected',+ },+ parameters: {+ ...RENAMED_SERIES_PARAMETERS,+ docs: {+ description: {+ story: 'Reopening the picker on a renamed series: the committed selection leads the Events list, labelled "Completed sign-up" with the underlying `signed up` event shown alongside (and in a tooltip on hover), so the row connects to the series the user clicked.',+ },+ },+ },+}++export const RenamedSeriesSelectedPill: Story = {+ render: (args) => {+ useMountedLogic(actionsModel)+ return (+ <div className="w-fit border rounded p-2 bg-surface-primary">+ <TaxonomicFilter {...args} />+ </div>+ )+ },+ args: {+ ...RENAMED_SERIES_ARGS,+ taxonomicFilterLogicKey: 'renamed-series-selected-pill',+ },+ parameters: {+ ...RENAMED_SERIES_PARAMETERS,+ featureFlags: { [FEATURE_FLAGS.TAXONOMIC_FILTER_CATEGORY_DROPDOWN]: 'pill' },+ docs: {+ description: {+ story: "Same renamed-series selection in the pill category-dropdown variant: the Categories column is folded into the search input's pill, and the promoted committed row still shows the rename with the underlying event.",+ },+ },+ },+}+export const EmptyEventsWithStaleToggle: Story = {render: (args) => {useMountedLogic(actionsModel)diff --git a/frontend/src/lib/components/TaxonomicFilter/menu/Combobox.test.tsx b/frontend/src/lib/components/TaxonomicFilter/menu/Combobox.test.tsxindex 7367eee0c9d1..94ae673db409 100644--- a/frontend/src/lib/components/TaxonomicFilter/menu/Combobox.test.tsx+++ b/frontend/src/lib/components/TaxonomicFilter/menu/Combobox.test.tsx@@ -241,6 +241,7 @@ describe('MenuFilterCombobox', () => {function renderEventsWithSelection(options: {searchQuery?: stringselectedEntry?: MenuFilterEntry+ selectedRename?: { label: string; raw: string }}): ReturnType<typeof render> {return render(<Provider>@@ -252,6 +253,7 @@ describe('MenuFilterCombobox', () => {<MenuFilterComboboxdrillTo="all"selectedEntry={options.selectedEntry}+ selectedRename={options.selectedRename}onCommit={jest.fn()}onBack={jest.fn()}/>@@ -313,6 +315,33 @@ describe('MenuFilterCombobox', () => {})+ it('labels the committed selection with the series rename, keeping the raw event key visible', async () => {+ apiGet.mockImplementation((url: string) => {+ if (url.includes('event_definitions')) {+ return Promise.resolve({+ results: [+ { id: 'def-1', name: 'user signed up' },+ { id: 'def-2', name: '$pageview' },+ ],+ count: 2,+ })+ }+ return Promise.resolve({ results: [], count: 0 })+ })++ renderEventsWithSelection({+ selectedEntry: syntheticEventSelected('user signed up'),+ selectedRename: { label: 'Signed up', raw: 'user signed up' },+ })++ await waitFor(() => expect(rowTexts().length).toBeGreaterThan(1))+ // Idle promotion floats the committed selection to the first row; its label is+ // the series' rename, with the raw event key kept inline so the connection to+ // the underlying event is visible.+ expect(rowTexts()[0]).toContain('Signed up')+ expect(rowTexts()[0]).toContain('user signed up')+ })+it('prefers an exact value match over the friendly-label heuristic when a custom event shares the label', async () => {// A custom event literally named "Pageview" coexists with core// "$pageview" (friendly label "Pageview"). A selection whose value isdiff --git a/frontend/src/lib/components/TaxonomicFilter/menu/Combobox.tsx b/frontend/src/lib/components/TaxonomicFilter/menu/Combobox.tsxindex 47a994b1522d..4a37a53eeccd 100644--- a/frontend/src/lib/components/TaxonomicFilter/menu/Combobox.tsx+++ b/frontend/src/lib/components/TaxonomicFilter/menu/Combobox.tsx@@ -35,6 +35,7 @@ import {Skeleton,} from '@posthog/quill'+import type { SeriesRename } from 'lib/components/EntityFilterInfo'import { LemonInput } from 'lib/lemon-ui/LemonInput'import { createFuse } from 'lib/utils/fuseSearch'import { surveyQuestionLabelsLogic } from 'scenes/surveys/surveyQuestionLabelsLogic'@@ -177,6 +178,8 @@ export interface MenuFilterComboboxProps {title?: string/** Currently-committed selection — rendered with a checkmark + scrolled into view. */selectedEntry?: MenuFilterEntry | null+ /** Rename (custom name) carried by the series being edited — applied to the selected row. */+ selectedRename?: SeriesRename | null/** Shared ref to the search input so the popover can target it for focus.* Mutable because the adapter assigns the input element onto it. */inputRef?: MutableRefObject<HTMLInputElement | null>@@ -198,6 +201,7 @@ export function MenuFilterCombobox({onBack,title,selectedEntry,+ selectedRename,inputRef: externalInputRef,iconButton,}: MenuFilterComboboxProps): JSX.Element {@@ -1098,6 +1102,7 @@ export function MenuFilterCombobox({// signal that with a chevron.opensSubmenu={drillTo === TaxonomicFilterGroupType.DataWarehouse}selectedRowId={selectedRowId}+ selectedRename={selectedRename}onSelect={() => onCommit(entry, undefined, selectionContextFor(entry))}/>)}@@ -1224,6 +1229,9 @@ interface RowProps {opensSubmenu?: boolean/** DOM id of the currently-selected row (for the trailing checkmark). */selectedRowId?: string | null+ /** Rename carried by the series being edited — applied to the selected row so its+ * label matches the series the user clicked, with the raw key as the value cell. */+ selectedRename?: SeriesRename | null/** Commit this row (also fires item-selected telemetry). */onSelect: () => void}@@ -1268,10 +1276,24 @@ function resolveRowCells(entry: MenuFilterEntry): {return { name: entry.name, category: entry.group.name }}-function Row({ entry, showCategory, recency, opensSubmenu, selectedRowId, onSelect }: RowProps): JSX.Element {- const { name, value, category } = resolveRowCells(entry)+function Row({+ entry,+ showCategory,+ recency,+ opensSubmenu,+ selectedRowId,+ selectedRename,+ onSelect,+}: RowProps): JSX.Element {+ const cells = resolveRowCells(entry)const stableId = rowDomId(entry)const isSelected = selectedRowId === stableId+ // The committed selection of a renamed series shows the series' name; the raw key+ // it queries moves to the value cell, like any other friendly-labelled row.+ const isRenamedSelection = isSelected && !!selectedRename && selectedRename.label !== cells.name+ const name = isRenamedSelection ? selectedRename.label : cells.name+ const value = isRenamedSelection && selectedRename.raw !== selectedRename.label ? selectedRename.raw : cells.value+ const category = cells.categoryreturn (<Autocomplete.Itemvalue={entry}@@ -1304,9 +1326,16 @@ function Row({ entry, showCategory, recency, opensSubmenu, selectedRowId, onSele<div className="flex flex-col items-start gap-0 min-w-0 flex-1"><span className="text-sm leading-tight truncate max-w-full">{name}</span>{/* The preview pane (hidden below `md`) is the primary home for the- raw value, so only narrow screens keep it inline on the row. */}+ raw value, so only narrow screens keep it inline on the row — except+ for a renamed selection, where the label alone doesn't reveal what+ the series queries, so the raw key stays inline at every size. */}{value && (- <span className="md:hidden font-mono text-xs text-tertiary/50 leading-tight truncate max-w-full">+ <span+ className={cn(+ 'font-mono text-xs text-tertiary/50 leading-tight truncate max-w-full',+ !isRenamedSelection && 'md:hidden'+ )}+ >{value}</span>)}diff --git a/frontend/src/lib/components/TaxonomicFilter/menu/TaxonomicFilterMenu.stories.tsx b/frontend/src/lib/components/TaxonomicFilter/menu/TaxonomicFilterMenu.stories.tsxindex de7678703272..72fbd01647af 100644--- a/frontend/src/lib/components/TaxonomicFilter/menu/TaxonomicFilterMenu.stories.tsx+++ b/frontend/src/lib/components/TaxonomicFilter/menu/TaxonomicFilterMenu.stories.tsx@@ -375,6 +375,57 @@ export const DefaultSurfaceWithRecents: Story = {},}+// ---- Renamed series selection -------------------------------------------+// Renders the combobox directly on the `all` scope with a committed selection+// whose series carries a rename: the promoted first row is labelled with the+// rename ("Completed sign-up") and keeps the raw event key visible beneath it.++function RenamedSeriesSelectionContainer(): JSX.Element {+ useMountedLogic(actionsModel)+ const selectedEntry: MenuFilterEntry = {+ item: { name: 'signed up', id: 'signed up' } as never,+ group: {+ type: TaxonomicFilterGroupType.Events,+ name: 'Events',+ getName: (t: any) => t?.name,+ getValue: (t: any) => t?.name ?? t?.id,+ } as unknown as TaxonomicFilterGroup,+ name: 'signed up',+ }+ return (+ <TaxonomicFilterHeadless.Root+ bindRootProps={false}+ taxonomicGroupTypes={[TaxonomicFilterGroupType.Events, TaxonomicFilterGroupType.Actions]}+ >+ <div className="border rounded overflow-hidden flex flex-col w-[720px] h-[420px] bg-surface-primary">+ <MenuFilterCombobox+ drillTo="all"+ selectedEntry={selectedEntry}+ selectedRename={{ label: 'Completed sign-up', raw: 'signed up' }}+ onCommit={() => {}}+ onBack={() => {}}+ />+ </div>+ </TaxonomicFilterHeadless.Root>+ )+}++export const RenamedSeriesSelection: Story = {+ // Excluded from the snapshot/flake gate for the same reason as+ // DefaultSurfaceWithRecents: the `all` scope fetches content lists and the+ // preview pane loads async, so the render isn't pixel-stable. Kept for the+ // Storybook demo; the rename labelling is covered by RTL in Combobox.test.tsx.+ tags: ['test-skip'],+ render: () => <RenamedSeriesSelectionContainer />,+ parameters: {+ docs: {+ description: {+ story: 'Reopening the rebuilt menu on a renamed series: the committed selection is promoted to the first row, labelled with the series\' rename ("Completed sign-up") while the raw `signed up` event key stays inline beneath it, with the checkmark and preview pane tracking the same row.',+ },+ },+ },+}+function bareKeyRecentEntries(): MenuFilterEntry[] {const group = {type: TaxonomicFilterGroupType.EventProperties,diff --git a/frontend/src/lib/components/TaxonomicFilter/menu/TaxonomicFilterMenu.tsx b/frontend/src/lib/components/TaxonomicFilter/menu/TaxonomicFilterMenu.tsxindex e5f5036bcb7a..35ad3b641293 100644--- a/frontend/src/lib/components/TaxonomicFilter/menu/TaxonomicFilterMenu.tsx+++ b/frontend/src/lib/components/TaxonomicFilter/menu/TaxonomicFilterMenu.tsx@@ -39,6 +39,7 @@ import {PopoverTrigger,} from '@posthog/quill'+import type { SeriesRename } from 'lib/components/EntityFilterInfo'import { formatPropertyLabel } from 'lib/components/PropertyFilters/utils'import { LemonButton } from 'lib/lemon-ui/LemonButton'import { isDefinitionStale } from 'lib/utils/definitions'@@ -70,6 +71,8 @@ export interface TaxonomicFilterMenuProps {triggerLabel?: string/** Currently-selected entry — drives the trigger label. Optional. */selected?: MenuFilterEntry | null+ /** Rename (custom name) carried by the series being edited — applied to the selected row in the combobox. */+ selectedRename?: SeriesRename | null/*** Trigger override. Static element or render function receiving* trigger state.@@ -234,6 +237,7 @@ export function resolveInitialMenuState(export function TaxonomicFilterMenu({triggerLabel,selected,+ selectedRename,trigger,onCommit,placeholder,@@ -721,6 +725,7 @@ export function TaxonomicFilterMenu({// already title themselves with the group name.title={state.drillTo === 'all' ? comboboxTitle : undefined}selectedEntry={selected ?? null}+ selectedRename={selectedRename}onCommit={handleCommit}onBack={openMenu}inputRef={comboboxInputRef}diff --git a/frontend/src/lib/components/TaxonomicFilter/types.ts b/frontend/src/lib/components/TaxonomicFilter/types.tsindex 6f13979e7421..77728a84ee82 100644--- a/frontend/src/lib/components/TaxonomicFilter/types.ts+++ b/frontend/src/lib/components/TaxonomicFilter/types.ts@@ -2,14 +2,15 @@ import Fuse from 'fuse.js'import { LogicWrapper } from 'kea'import { ReactNode } from 'react'-import { LocalFilter } from 'scenes/insights/filters/ActionFilter/entityFilterLogic'// eslint-disable-next-line import/no-cycleimport { MaxContextTaxonomicFilterOption } from 'scenes/max/maxTypes'import { AnyDataNode, DatabaseSchemaField, DatabaseSerializedFieldType } from '~/queries/schema/schema-general'import {+ ActionFilter,ActionType,CohortType,+ EntityFilter,EventDefinition,EventPropertyFilter,PersonProperty,@@ -123,7 +124,9 @@ export interface TaxonomicFilterProps {onChange?: (group: TaxonomicFilterGroup, value: TaxonomicFilterValue, item: any) => voidonEnter?: (query: string) => voidonClose?: () => void- filter?: LocalFilter+ /** The series/entity filter the picker is editing — lets the list surface+ * the committed selection with its rename (`custom_name`) applied. */+ filter?: EntityFilter | ActionFiltertaxonomicGroupTypes: TaxonomicFilterGroupType[]taxonomicFilterLogicKey?: stringoptionsFromProp?: Partial<Record<TaxonomicFilterGroupType, SimpleOption[]>>diff --git a/frontend/src/lib/components/TaxonomicPopover/TaxonomicPopover.tsx b/frontend/src/lib/components/TaxonomicPopover/TaxonomicPopover.tsxindex 2273f9a7c76e..cd82ec54d2f4 100644--- a/frontend/src/lib/components/TaxonomicPopover/TaxonomicPopover.tsx+++ b/frontend/src/lib/components/TaxonomicPopover/TaxonomicPopover.tsx@@ -18,10 +18,10 @@ import { FEATURE_FLAGS } from 'lib/constants'import { LemonButton, LemonButtonProps } from 'lib/lemon-ui/LemonButton'import { LemonDropdown } from 'lib/lemon-ui/LemonDropdown'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'-import { LocalFilter } from 'scenes/insights/filters/ActionFilter/entityFilterLogic'import { MaxContextTaxonomicFilterOption } from 'scenes/max/maxTypes'import { AnyDataNode, DatabaseSchemaField } from '~/queries/schema/schema-general'+import { ActionFilter, EntityFilter } from '~/types'import { taxonomicMenuPreferenceLogic } from './taxonomicMenuPreferenceLogic'import { TaxonomicMenuToggle } from './TaxonomicMenuToggle'@@ -35,7 +35,7 @@ export interface TaxonomicPopoverProps<ValueType extends TaxonomicFilterValue =value?: ValueType | nullonChange: (value: ValueType, groupType: TaxonomicFilterGroupType, item: any) => void- filter?: LocalFilter+ filter?: EntityFilter | ActionFiltergroupTypes?: TaxonomicFilterGroupType[]renderValue?: (value: ValueType) => JSX.Element | nulleventNames?: string[]@@ -231,6 +231,7 @@ export const TaxonomicPopover = forwardRef(function TaxonomicPopover_<<TaxonomicPopoverMenu<ValueType>groupType={groupType}value={value}+ filter={filter}groupTypes={groupTypes}onChange={onChange}renderValue={renderValue}diff --git a/frontend/src/lib/components/TaxonomicPopover/TaxonomicPopoverMenu.tsx b/frontend/src/lib/components/TaxonomicPopover/TaxonomicPopoverMenu.tsxindex 6017a8a41fb5..3ce1a7defcda 100644--- a/frontend/src/lib/components/TaxonomicPopover/TaxonomicPopoverMenu.tsx+++ b/frontend/src/lib/components/TaxonomicPopover/TaxonomicPopoverMenu.tsx@@ -23,6 +23,7 @@ import { ReactElement, useMemo, useState } from 'react'import { IconChevronDown, IconFilter } from '@posthog/icons'+import { SeriesRename, getSeriesRename } from 'lib/components/EntityFilterInfo'import { TaxonomicFilterHeadless } from 'lib/components/TaxonomicFilter/headless'import { MenuFilterEntry, TaxonomicFilterMenu } from 'lib/components/TaxonomicFilter/menu'import { MenuInputTrigger } from 'lib/components/TaxonomicFilter/menu/InputTrigger'@@ -42,6 +43,7 @@ import { databaseTableListLogic } from 'scenes/data-management/database/databaseimport { MaxContextTaxonomicFilterOption } from 'scenes/max/maxTypes'import { AnyDataNode, DatabaseSchemaField } from '~/queries/schema/schema-general'+import { ActionFilter, EntityFilter } from '~/types'import { TaxonomicMenuToggle } from './TaxonomicMenuToggle'@@ -67,6 +69,8 @@ type TriggerButtonProps = Pick<export interface TaxonomicPopoverMenuProps<ValueType extends TaxonomicFilterValue = TaxonomicFilterValue> {groupType: TaxonomicFilterGroupTypevalue?: ValueType | null+ /** The series/entity filter being edited — surfaces its rename on the committed selection. */+ filter?: EntityFilter | ActionFiltergroupTypes?: TaxonomicFilterGroupType[]/** The 4th arg is the orchestrator's resolved group — consumers that* need the full `TaxonomicFilterGroup` (not just its type) can use it. */@@ -206,6 +210,7 @@ export function TaxonomicPopoverMenu<ValueType extends TaxonomicFilterValue = Tafunction ArmedTaxonomicPopoverMenu<ValueType extends TaxonomicFilterValue = TaxonomicFilterValue>({groupType,value,+ filter,groupTypes,onChange,renderValue,@@ -278,6 +283,10 @@ function ArmedTaxonomicPopoverMenu<ValueType extends TaxonomicFilterValue = Taxo} as unknown as MenuFilterEntry}, [value, selectedGroupType, dataWarehouseTablesMap])+ // A renamed series doesn't reveal the thing it queries — surface the rename on the+ // committed selection's row so the user can connect it to the series they clicked.+ const selectedRename = useMemo<SeriesRename | null>(() => getSeriesRename(filter), [filter])+return (<TaxonomicFilterHeadless.Root// `display: contents` — the Root wrapper div must not affect@@ -316,6 +325,7 @@ function ArmedTaxonomicPopoverMenu<ValueType extends TaxonomicFilterValue = Taxo><TaxonomicFilterMenuselected={selected}+ selectedRename={selectedRename}dataWarehousePopoverFields={dataWarehousePopoverFields}fullWidthTrigger={!!triggerButtonProps?.fullWidth}triggerAccessory={<TaxonomicMenuToggle />}diff --git a/frontend/src/scenes/experiments/charts/funnel/StepLegend.tsx b/frontend/src/scenes/experiments/charts/funnel/StepLegend.tsxindex f12f74eda5f2..1b6c212d145a 100644--- a/frontend/src/scenes/experiments/charts/funnel/StepLegend.tsx+++ b/frontend/src/scenes/experiments/charts/funnel/StepLegend.tsx@@ -1,5 +1,6 @@import { IconClock } from '@posthog/icons'+import { EntityFilterInfo } from 'lib/components/EntityFilterInfo'import { IconTrendingFlat, IconTrendingFlatDown } from 'lib/lemon-ui/icons'import { LemonRow } from 'lib/lemon-ui/LemonRow'import { Lettermark, LettermarkColor } from 'lib/lemon-ui/Lettermark'@@ -7,6 +8,7 @@ import { Tooltip } from 'lib/lemon-ui/Tooltip'import { humanFriendlyDuration } from 'lib/utils/durations'import { percentage } from 'lib/utils/numbers'import { capitalizeFirstLetter, pluralize } from 'lib/utils/strings'+import { getActionFilterFromFunnelStep } from 'scenes/insights/views/Funnels/funnelStepTableUtils'import { isExperimentFunnelMetric } from '~/queries/schema/schema-general'import { FunnelStepWithConversionMetrics, StepOrderValue } from '~/types'@@ -25,9 +27,7 @@ export function StepLegend({ step, stepIndex, showTime }: StepLegendProps): JSX.const isUnorderedFunnel =!!metric && isExperimentFunnelMetric(metric) && metric.funnel_order_type === StepOrderValue.UNORDERED- const stepLabel = isUnorderedFunnel- ? `Completed ${stepIndex + 1} ${stepIndex === 0 ? 'step' : 'steps'}`- : step.custom_name || step.name+ const unorderedStepLabel = `Completed ${stepIndex + 1} ${stepIndex === 0 ? 'step' : 'steps'}`const convertedCountPresentation = pluralize(step.count ?? 0,@@ -56,7 +56,11 @@ export function StepLegend({ step, stepIndex, showTime }: StepLegendProps): JSX.return (<div className="StepLegend"><LemonRow icon={<Lettermark name={stepIndex + 1} color={LettermarkColor.Gray} />}>- <span title={stepLabel}>{stepLabel}</span>+ {isUnorderedFunnel ? (+ <span title={unorderedStepLabel}>{unorderedStepLabel}</span>+ ) : (+ <EntityFilterInfo filter={getActionFilterFromFunnelStep(step)} allowWrap />+ )}</LemonRow><LemonRow icon={<IconTrendingFlat />} status="success" style={{ color: 'unset' }}><Tooltipdiff --git a/frontend/src/scenes/funnels/FunnelFlowGraph/BuilderStepNode.tsx b/frontend/src/scenes/funnels/FunnelFlowGraph/BuilderStepNode.tsxindex c4db6199857a..99d2c7dade21 100644--- a/frontend/src/scenes/funnels/FunnelFlowGraph/BuilderStepNode.tsx+++ b/frontend/src/scenes/funnels/FunnelFlowGraph/BuilderStepNode.tsx@@ -1,7 +1,7 @@import { Handle, Position } from '@xyflow/react'import clsx from 'clsx'import { useActions, useValues } from 'kea'-import React from 'react'+import React, { useMemo } from 'react'import { IconCollapse, IconPlayFilled, IconX } from '@posthog/icons'import { LemonButton, Spinner } from '@posthog/lemon-ui'@@ -145,6 +145,9 @@ export const BuilderStepNode = React.memo(function BuilderStepNode({const canRemove = stepCount > 1const hasEvent = !!step.action_idconst hasConversionData = step.count != null && step.count > 0+ // Stable identity — a fresh filter each render would defeat the picker's+ // rename memo and re-render every visible list row while it is open.+ const stepFilter = useMemo(() => (hasEvent ? getActionFilterFromFunnelStep(step) : undefined), [hasEvent, step])return (<StepNodeShell@@ -164,14 +167,11 @@ export const BuilderStepNode = React.memo(function BuilderStepNode({groupType={TaxonomicFilterGroupType.Events}groupTypes={taxonomicGroupTypes}value={hasEvent ? (step.action_id as string) : undefined}+ filter={stepFilter}onChange={(value, groupType, item) => {updateStepEvent(stepIndex, value as string, groupType, item)}}- renderValue={- hasEvent- ? () => <EntityFilterInfo filter={getActionFilterFromFunnelStep(step)} />- : undefined- }+ renderValue={stepFilter ? () => <EntityFilterInfo filter={stepFilter} /> : undefined}type="secondary"size="small"fullWidthdiff --git a/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/ActionFilterRow.test.tsx b/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/ActionFilterRow.test.tsxindex 3cbd8faad50b..a15ece5c96f3 100644--- a/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/ActionFilterRow.test.tsx+++ b/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/ActionFilterRow.test.tsx@@ -163,6 +163,37 @@ describe('ActionFilterRow', () => {expect(document.querySelector('.ActionFilterRow')!.textContent).toContain('Pageview')})+ it('shows the underlying event alongside a renamed series', () => {+ const { logic } = setup()+ renderRow(logic, {+ filter: { ...DEFAULT_FILTER, id: 'user signed up', name: 'Signed up', custom_name: 'Signed up' },+ })+ const row = document.querySelector('.ActionFilterRow')!+ expect(row.textContent).toContain('Signed up')+ expect(row.textContent).toContain('user signed up')+ })++ it('opens the picker with the renamed selection first, labelled by the series name', async () => {+ const { logic } = setup()+ renderRow(logic, {+ ...INLINE_CONTEXT,+ filter: { ...DEFAULT_FILTER, id: 'user signed up', name: 'Signed up', custom_name: 'Signed up' },+ })++ await userEvent.click(screen.getByTestId('trend-element-subject-0'))++ // The committed selection leads the list, labelled with the series' rename+ // and revealing the event it actually queries.+ await waitFor(() => {+ const rows = Array.from(document.querySelectorAll('.taxonomic-list-row'))+ const selectedRow = rows.find(+ (row) => row.textContent?.includes('Signed up') && row.textContent?.includes('user signed up')+ )+ expect(selectedRow).toBeTruthy()+ expect(selectedRow!.getAttribute('data-attr')).toMatch(/-0$/)+ })+ })+describe('series indicators', () => {it.each([['alpha', 'A'],diff --git a/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/ActionFilterRow.tsx b/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/ActionFilterRow.tsxindex e96ed33d2be4..395a20d1df60 100644--- a/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/ActionFilterRow.tsx+++ b/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/ActionFilterRow.tsx@@ -28,6 +28,7 @@ import { databaseTableListLogic } from 'scenes/data-management/database/databaseimport { funnelDataLogic } from 'scenes/funnels/funnelDataLogic'import { insightDataLogic } from 'scenes/insights/insightDataLogic'import { insightLogic } from 'scenes/insights/insightLogic'+import { isAllEventsEntityFilter } from 'scenes/insights/utils'import { teamLogic } from 'scenes/teamLogic'import { MathCategory, mathTypeToApiValues, mathsLogic } from 'scenes/trends/mathsLogic'@@ -329,7 +330,9 @@ export function ActionFilterRow({value = action?.id || filter.id} else {name = filter.name || String(filter.id)- value = filter.name || filter.id+ // `id` is the event actually queried — `name` can be a rename (e.g. set via the API),+ // and committing it as the taxonomic value would select a non-existent event.+ value = filter.id != null && filter.id !== '' ? filter.id : (filter.name ?? null)}const seriesIndicator =@@ -345,7 +348,20 @@ export function ActionFilterRow({typeKey === 'plugin-filters'? TaxonomicFilterGroupType.DataWarehouseSourceTables: TaxonomicFilterGroupType.DataWarehouse- const initialGroupType = isDataWarehouseFilter ? dataWarehouseGroupType : TaxonomicFilterGroupType.SuggestedFilters+ // The committed value's real group — it drives the picker's committed-selection+ // affordance (selected row floats to the top, with the series' rename applied).+ // The picker still opens on the suggested-filters surface either way. All-events+ // and inline-group series have no single committed row to promote.+ const initialGroupType = isDataWarehouseFilter+ ? dataWarehouseGroupType+ : filter.type === EntityTypes.ACTIONS+ ? TaxonomicFilterGroupType.Actions+ : filter.type === EntityTypes.EVENTS &&+ !isAllEventsEntityFilter(filter) &&+ filter.id != null &&+ filter.id !== ''+ ? TaxonomicFilterGroupType.Events+ : TaxonomicFilterGroupType.SuggestedFilters// DWH events are not supported in inline events yetconst canCombine = showCombine && !singleFilter && !isDataWarehouseFilter