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): humanize event name in stickiness actors modal (#65523)

Thomas Obermüllera091cac9f732
diff --git a/products/product_analytics/frontend/insights/stickiness/StickinessBarChart/StickinessBarChart.test.tsx b/products/product_analytics/frontend/insights/stickiness/StickinessBarChart/StickinessBarChart.test.tsx
index f57ae53aca6e..3e85217f3ec7 100644
--- a/products/product_analytics/frontend/insights/stickiness/StickinessBarChart/StickinessBarChart.test.tsx
+++ b/products/product_analytics/frontend/insights/stickiness/StickinessBarChart/StickinessBarChart.test.tsx
@@ -101,7 +101,7 @@ describe('StickinessBarChart', () => {
expect(screen.queryByRole('img', { name: /chart with/i })).not.toBeInTheDocument()
})
- it('click → persons modal: opens with a "Stickiness on {interval} {day}" title', async () => {
+ it('click → persons modal: opens with a "stickiness on {interval} {day}" title', async () => {
renderInsight({ query: stickinessBar() })
await chart.clickAtIndex(2)
@@ -112,8 +112,9 @@ describe('StickinessBarChart', () => {
},
{ timeout: 5000 }
)
- expect(personsModal.title()).toMatch(/Stickiness on day 3/)
- expect(personsModal.title()).toMatch(/Pageview/i)
+ expect(personsModal.title()).toMatch(/stickiness on day 3/)
+ // Case-sensitive: the core event must be humanized ("Pageview"), not the raw "$pageview".
+ expect(personsModal.title()).toMatch(/Pageview/)
})
it('click → context.onDataPointClick fires with the integer day instead of opening the modal', async () => {
diff --git a/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/StickinessLineChart.test.tsx b/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/StickinessLineChart.test.tsx
index d52c5426b9e6..dedbeb0012fb 100644
--- a/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/StickinessLineChart.test.tsx
+++ b/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/StickinessLineChart.test.tsx
@@ -87,7 +87,7 @@ describe('StickinessLineChart', () => {
})
describe('click → persons modal', () => {
- it('opens the modal with a "Stickiness on {interval} {day}" title', async () => {
+ it('opens the modal with a "stickiness on {interval} {day}" title', async () => {
renderInsight({ query: buildStickinessQuery() })
await chart.clickAtIndex(2)
@@ -96,8 +96,9 @@ describe('StickinessLineChart', () => {
expect(personsModal.get()).toBeInTheDocument()
})
// The clicked bucket is index 2, days are 1-indexed in the mock, so day == 3.
- expect(personsModal.title()).toMatch(/Stickiness on day 3/)
- expect(personsModal.title()).toMatch(/Pageview/i)
+ expect(personsModal.title()).toMatch(/stickiness on day 3/)
+ // Case-sensitive: the core event must be humanized ("Pageview"), not the raw "$pageview".
+ expect(personsModal.title()).toMatch(/Pageview/)
})
it('fires context.onDataPointClick with the integer day instead of opening the modal', async () => {
diff --git a/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/handleStickinessChartClick.test.tsx b/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/handleStickinessChartClick.test.tsx
index 4bf0731e6165..31ff7071ed7d 100644
--- a/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/handleStickinessChartClick.test.tsx
+++ b/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/handleStickinessChartClick.test.tsx
@@ -74,7 +74,7 @@ describe('handleStickinessChartClick', () => {
expect(call.orderBy).toBeUndefined()
})
- it('renders a "Stickiness on {interval} {day}" title with the series label', () => {
+ it('renders a "stickiness on {interval} {day}" title with the series label', () => {
const openPersonsModal = jest.fn()
const trendResult = makeTrendResult({ label: '$pageview' })
const deps = makeDeps({ openPersonsModal, interval: 'day', indexedResults: [trendResult] })
@@ -82,9 +82,10 @@ describe('handleStickinessChartClick', () => {
handleStickinessChartClick(keyFor(trendResult), 2, deps)
const { container } = render(<>{openPersonsModal.mock.calls[0][0].title}</>)
- // PropertyKeyInfo wraps the raw label; the label text itself surfaces in textContent.
- expect(container.textContent).toContain('$pageview')
- expect(container.textContent).toContain('Stickiness on day 3')
+ // PropertyKeyInfo humanizes the core event name, so "$pageview" surfaces as "Pageview".
+ expect(container.textContent).toContain('Pageview')
+ expect(container.textContent).not.toContain('$pageview')
+ expect(container.textContent).toContain('stickiness on day 3')
})
it('uses "day" as the default interval when interval is null', () => {
@@ -95,7 +96,7 @@ describe('handleStickinessChartClick', () => {
handleStickinessChartClick(keyFor(trendResult), 0, deps)
const { container } = render(<>{openPersonsModal.mock.calls[0][0].title}</>)
- expect(container.textContent).toContain('Stickiness on day 1')
+ expect(container.textContent).toContain('stickiness on day 1')
})
it.each([
diff --git a/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/handleStickinessChartClick.tsx b/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/handleStickinessChartClick.tsx
index d23b722774ff..032f879547b1 100644
--- a/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/handleStickinessChartClick.tsx
+++ b/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/handleStickinessChartClick.tsx
@@ -1,4 +1,5 @@
import { PropertyKeyInfo } from 'lib/components/PropertyKeyInfo'
+import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'
import type { OpenPersonsModalProps } from 'scenes/trends/persons-modal/PersonsModal'
import type { IndexedTrendResult } from 'scenes/trends/types'
import { datasetToActorsQuery } from 'scenes/trends/viz/datasetToActorsQuery'
@@ -56,7 +57,8 @@ export function handleStickinessChartClick(seriesKey: string, dataIndex: number,
const label = dataset.label ?? ''
const title = (
<>
- <PropertyKeyInfo value={label} disablePopover /> Stickiness on {deps.interval || 'day'} {day}
+ <PropertyKeyInfo value={label} disablePopover type={TaxonomicFilterGroupType.Events} /> stickiness on{' '}
+ {deps.interval || 'day'} {day}
</>
)