Skip to content

: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.

fix(taxonomic-filter): save SQL expression in rebuilt filter menu (#61946)

Adam Leith2497859ceae8
diff --git a/frontend/src/lib/components/TaxonomicFilter/utils/buildTaxonomicGroups.tsx b/frontend/src/lib/components/TaxonomicFilter/utils/buildTaxonomicGroups.tsx
index 6259be6fd9bd..75cdb79c212b 100644
--- a/frontend/src/lib/components/TaxonomicFilter/utils/buildTaxonomicGroups.tsx
+++ b/frontend/src/lib/components/TaxonomicFilter/utils/buildTaxonomicGroups.tsx
@@ -907,6 +907,10 @@ export function buildTaxonomicGroups(ctx: BuildTaxonomicGroupsContext): Taxonomi
categoryLabel: () => 'SQL expression',
type: TaxonomicFilterGroupType.HogQLExpression,
render: InlineHogQLEditor,
+ // The headless menu derives the committed value via group.getValue(item);
+ // without this the SQL expression resolves to null and the selection is
+ // silently dropped on save.
+ getValue: (option) => (option as { value?: TaxonomicFilterValue }).value ?? option.name,
getPopoverHeader: () => 'SQL expression',
componentProps: { metadataSource, ...hogQLExpressionComponentProps },
},