: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(taxonomic-filter): use neutral copy for custom event names (#105941)
Paul D'Ambra5de27b4d654c
diff --git a/docs/internal/taxonomic-filter-search.md b/docs/internal/taxonomic-filter-search.mdindex 4e01e80fc866..5194b8773bae 100644--- a/docs/internal/taxonomic-filter-search.md+++ b/docs/internal/taxonomic-filter-search.md@@ -9,6 +9,9 @@ The rail starts undocked. `taxonomic filter category rail toggled` records whethA category shows results for the current query only. It clears its earlier rows when the current query cannot fetch, such as a query below the category minimum length or a request that failed.In the classic picker, a failed search with no usable matches shows an error and a retry action.A failed search does not offer an uncaptured event name, and it does not change the selected form value.+When a caller allows custom event names, a successful empty search offers "Use event name".+Pressing Enter in the search input selects that custom event name.+The classic picker does not infer ingestion history from a filtered definition list.Scoped property searches return properties associated with the selected events. A separate unscoped request counts matches across the project so the picker can offer an expansion to other properties.diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex e3e26a541ddc..8eb56c6d7d38 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -3144,6 +3144,10 @@ snapshots:hash: v1.k794b7964.4ecf5ef9bc95151a6444f1b7247ced4f43ad62f12399783f180c8d82f2b05021.12FrJN6IzU1RbrsFSt_QSvWv4xtr7haSiCTFtyE4ks4filters-taxonomic-filter--cohorts-with-realtime-states--light:hash: v1.k794b7964.c31271e138b12e3328be8e2cfb274debb8e9f0962628bf7fade105700d643279.AtCH44-aoOKmp6KdEobKIZ3sTK751wyBALto1doHhZc+ filters-taxonomic-filter--custom-event-name--dark:+ hash: v1.k794b7964.a0c767041bbb0d158cc2b0807499c15544b35583bf31a5c0807431569a6a84e3.6ZOVo2HWc0MbKgxBQzxPSiZQZVMzxxdKkvhMZOAgT-M+ filters-taxonomic-filter--custom-event-name--light:+ hash: v1.k794b7964.7f0b97353f226ffb96560f2cf57c9b8eb51316eb387b898e773db7d61c94ed2e.DZ0haR5pv4fLsPtf9sXBi1YY_foTT99ynn4zrkgoXrsfilters-taxonomic-filter--dashboard-property-search--dark:hash: v1.k794b7964.c824be157968e0ef1b8dc82810f4a06dfff364af71722c53823f1d95d4542f7f.D-ZfI3CwGqAa9tdEaUF_psLO6gqWhGZTQnN6Y9i8GRYfilters-taxonomic-filter--dashboard-property-search--light:diff --git a/frontend/src/lib/components/TaxonomicFilter/InfiniteList.tsx b/frontend/src/lib/components/TaxonomicFilter/InfiniteList.tsxindex a4d912bd7ecd..14a5555fb327 100644--- a/frontend/src/lib/components/TaxonomicFilter/InfiniteList.tsx+++ b/frontend/src/lib/components/TaxonomicFilter/InfiniteList.tsx@@ -543,11 +543,8 @@ export const InfiniteListRow = ({data-attr="prop-filter-event-option-custom"><div className="flex items-center gap-2">- <span className="text-muted">Select event:</span>+ <span className="text-muted">Use event name:</span><span className="font-medium">{trimmedSearchQuery}</span>- <LemonTag type="caution" size="small">- Not seen yet- </LemonTag></div></LemonRow>)diff --git a/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.stories.tsx b/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.stories.tsxindex b6af6dc89366..68e56d768e8d 100644--- a/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.stories.tsx+++ b/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.stories.tsx@@ -730,6 +730,30 @@ export const FailedFetchOffersRetry: Story = {},}+export const CustomEventName: Story = {+ render: (args) => {+ const { setSearchQuery } = useActions(+ taxonomicFilterLogic({ ...args, taxonomicFilterLogicKey: args.taxonomicFilterLogicKey as string })+ )+ useOnMountEffect(() => setSearchQuery('purchase_confirmed'))+ return <TaxonomicFilter {...args} />+ },+ args: {+ taxonomicFilterLogicKey: 'custom-event-name',+ taxonomicGroupTypes: [TaxonomicFilterGroupType.Events],+ groupType: TaxonomicFilterGroupType.Events,+ allowNonCapturedEvents: true,+ },+ decorators: [+ mswDecorator({+ get: {+ '/api/projects/:team_id/event_definitions': () => [200, { results: [], count: 0 }],+ },+ }),+ ],+ parameters: { testOptions: { waitForSelector: '[data-attr="prop-filter-event-option-custom"]' } },+}+export const CohortsWithRealtimeStates: Story = {args: {taxonomicFilterLogicKey: 'cohorts-realtime',diff --git a/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.test.tsx b/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.test.tsxindex c28ae34d6b73..8bb222191745 100644--- a/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.test.tsx+++ b/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.test.tsx@@ -108,6 +108,36 @@ describe('TaxonomicFilter', () => {)}+ it.each(['mouse', 'keyboard'] as const)(+ 'selects a custom event name with neutral copy using the %s',+ async (input) => {+ useMocks({+ get: {+ '/api/projects/:team/event_definitions': () => [200, { results: [], count: 0 }],+ },+ })+ taxonomicFilterCategoryLayoutLogic.actions.setCategoryRailPinned(input === 'keyboard')+ renderFilter({ allowNonCapturedEvents: true })+ await withoutDebounceDelay(async (user) => {+ await user.type(screen.getByTestId('taxonomic-filter-searchfield'), 'purchase_confirmed')+ })++ const option = await screen.findByTestId('prop-filter-event-option-custom')+ expect(option).toHaveTextContent(/Use event name:\s*purchase_confirmed/)+ expect(screen.queryByText('Not seen yet')).not.toBeInTheDocument()+ if (input === 'mouse') {+ await userEvent.click(option)+ } else {+ fireEvent.keyDown(screen.getByTestId('taxonomic-filter-searchfield'), { key: 'Enter' })+ }+ expect(onChangeMock).toHaveBeenCalledWith(+ expect.objectContaining({ type: TaxonomicFilterGroupType.Events }),+ 'purchase_confirmed',+ expect.objectContaining({ name: 'purchase_confirmed', isNonCaptured: true })+ )+ }+ )+function expectActiveTab(activeTestId: string, inactiveTestId?: string): void {expect(screen.getByTestId(activeTestId)).toHaveClass('LemonTag--primary')if (inactiveTestId) {diff --git a/frontend/src/lib/components/TaxonomicFilter/infiniteListLogic.ts b/frontend/src/lib/components/TaxonomicFilter/infiniteListLogic.tsindex ae4a436d45ad..b6c443e4ce45 100644--- a/frontend/src/lib/components/TaxonomicFilter/infiniteListLogic.ts+++ b/frontend/src/lib/components/TaxonomicFilter/infiniteListLogic.ts@@ -2294,6 +2294,13 @@ export const infiniteListLogic = kea<infiniteListLogicType>([selectSelected: () => {if (values.isExpandableButtonSelected) {actions.expand()+ } else if (values.showNonCapturedEventOption && values.group) {+ actions.selectItem(+ values.group,+ values.trimmedSearchQuery,+ { name: values.trimmedSearchQuery, isNonCaptured: true },+ { position: 0 }+ )} else {const selectedItem = values.selectedItemconst itemGroup = getItemGroup(selectedItem, values.taxonomicGroups, values.group)