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.

chore(insights): cover retry button side action rendering (#72082)

Gustavo H. Strassburger6ef8ccdd828a
diff --git a/frontend/src/scenes/insights/EmptyStates/InsightErrorStates.test.tsx b/frontend/src/scenes/insights/EmptyStates/InsightErrorStates.test.tsx
index e0538fd499d1..12d7367400ec 100644
--- a/frontend/src/scenes/insights/EmptyStates/InsightErrorStates.test.tsx
+++ b/frontend/src/scenes/insights/EmptyStates/InsightErrorStates.test.tsx
@@ -50,4 +50,20 @@ describe('insight error states', () => {
query_id: 'test-query-id',
})
})
+
+ // The retry button only offers a side action (query debugger link) when it has a query. Without
+ // one, `sideAction` must stay undefined so LemonButton doesn't render a stray empty side action.
+ it.each([
+ { name: 'without a query', query: undefined, expectsSideAction: false },
+ {
+ name: 'with a query',
+ query: { kind: 'InsightVizNode', source: { kind: 'TrendsQuery' } },
+ expectsSideAction: true,
+ },
+ ])('retry button side action $name', ({ query, expectsSideAction }) => {
+ const { container } = render(<InsightErrorState onRetry={() => {}} query={query} />)
+
+ expect(container.querySelector('[data-attr="insight-retry-button"]')).not.toBeNull()
+ expect(container.querySelector('.LemonButtonWithSideAction') !== null).toBe(expectsSideAction)
+ })
})