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(insights): dismiss pinned tooltip when a row opens the persons modal (#83159)

Sam Pennington3014e4a2b3a7
diff --git a/products/product_analytics/frontend/insights/shared/InsightSeriesTooltip.tsx b/products/product_analytics/frontend/insights/shared/InsightSeriesTooltip.tsx
index 15e8dd8d3b52..29c0480a2acf 100644
--- a/products/product_analytics/frontend/insights/shared/InsightSeriesTooltip.tsx
+++ b/products/product_analytics/frontend/insights/shared/InsightSeriesTooltip.tsx
@@ -338,14 +338,17 @@ export function InsightSeriesTooltip<Meta extends InsightSeriesMetaBase>({
return formattedDate
}, [context.seriesData, datumByKey, interval, dateRange, timezone, weekStartDay, altTitle])
+ const onUnpin = context.onUnpin
const onRowClickEntry = useCallback(
(entry: InsightSeriesTooltipEntry<Meta>): void => {
const datum = datumByKey.get(entry.series.key)
if (datum) {
+ // The drill-down opens a modal over the chart, so a pin left behind would float on top of it.
+ onUnpin?.()
onRowClick?.(datum)
}
},
- [datumByKey, onRowClick]
+ [datumByKey, onRowClick, onUnpin]
)
return (
diff --git a/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.test.tsx b/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.test.tsx
index 96cce060ff76..07adcff6fd61 100644
--- a/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.test.tsx
+++ b/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.test.tsx
@@ -670,6 +670,8 @@ describe('TrendsLineChart', () => {
await waitFor(() => {
expect(personsModal.actorNames()).toEqual(['[email protected]'])
})
+ // The pin outlives the click unless the drill-down drops it, leaving the tooltip over the modal.
+ expect(chart.getTooltip()).not.toBeInTheDocument()
})
it('fires context.onDataPointClick instead of opening the persons modal', async () => {