: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): respect hide annotations toggle on funnel trends (#65092)
Sam Penningtone6c20b7dda8a
diff --git a/products/product_analytics/frontend/insights/funnels/FunnelLineChart/FunnelLineChart.test.tsx b/products/product_analytics/frontend/insights/funnels/FunnelLineChart/FunnelLineChart.test.tsxindex 41b6e5a74db5..072dc0e74243 100644--- a/products/product_analytics/frontend/insights/funnels/FunnelLineChart/FunnelLineChart.test.tsx+++ b/products/product_analytics/frontend/insights/funnels/FunnelLineChart/FunnelLineChart.test.tsx@@ -299,5 +299,36 @@ describe('FunnelLineChart', () => {}})++ it.each([+ { showAnnotations: undefined, expectsBadges: true },+ { showAnnotations: true, expectsBadges: true },+ { showAnnotations: false, expectsBadges: false },+ ])(+ 'respects the showAnnotations funnels filter (showAnnotations=$showAnnotations)',+ async ({ showAnnotations, expectsBadges }) => {+ renderInsight({+ query: buildFunnelsQuery({ funnelsFilter: { showAnnotations } }),+ mocks: {+ annotations: [+ buildAnnotation({+ scope: AnnotationScope.Project,+ content: 'Hedgehog spotted',+ date_marker: '2024-06-12T12:00:00Z',+ }),+ ],+ },+ })++ if (expectsBadges) {+ await waitFor(() => {+ expect(document.querySelectorAll('.AnnotationsBadge').length).toBeGreaterThan(0)+ })+ } else {+ await screen.findByRole('img', { name: /chart with/i })+ expect(document.querySelectorAll('.AnnotationsBadge')).toHaveLength(0)+ }+ }+ )})})diff --git a/products/product_analytics/frontend/insights/funnels/FunnelLineChart/FunnelLineChart.tsx b/products/product_analytics/frontend/insights/funnels/FunnelLineChart/FunnelLineChart.tsxindex df0eb3c048b3..bc409547546f 100644--- a/products/product_analytics/frontend/insights/funnels/FunnelLineChart/FunnelLineChart.tsx+++ b/products/product_analytics/frontend/insights/funnels/FunnelLineChart/FunnelLineChart.tsx@@ -146,6 +146,7 @@ export function FunnelLineChart({const resolvedGroupTypeLabel = resolveGroupTypeLabel(labelGroupType, aggregationLabel)const labels = steps[0]?.labels ?? EMPTY_STRINGSconst annotationDates = steps[0]?.days ?? EMPTY_STRINGS+ const showAnnotations = !inSharedMode && funnelsFilter?.showAnnotations !== falseconst clickDeps: FunnelLineChartClickDeps = {hasPersonsModal: showPersonsModal,@@ -206,7 +207,7 @@ export function FunnelLineChart({dataAttr="trend-line-graph-funnel"onError={handleChartError}>- {!inSharedMode && <AnnotationsLayer insightNumericId={insight.id || 'new'} dates={annotationDates} />}+ {showAnnotations && <AnnotationsLayer insightNumericId={insight.id || 'new'} dates={annotationDates} />}</TimeSeriesLineChart></ChartLegend>)