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(error-tracking): surface load failures on the issue detail tabs (#76502)

posthog[bot]b38065a05cbb
diff --git a/products/error_tracking/frontend/components/Breakdowns/BreakdownsTileButton.tsx b/products/error_tracking/frontend/components/Breakdowns/BreakdownsTileButton.tsx
index ca95e7753808..39dc3eb41029 100644
--- a/products/error_tracking/frontend/components/Breakdowns/BreakdownsTileButton.tsx
+++ b/products/error_tracking/frontend/components/Breakdowns/BreakdownsTileButton.tsx
@@ -1,7 +1,7 @@
import { useActions, useValues } from 'kea'
import posthog from 'posthog-js'
-import { LemonSkeleton } from '@posthog/lemon-ui'
+import { LemonSkeleton, Tooltip } from '@posthog/lemon-ui'
import { cn } from 'lib/utils/css-classes'
import { BREAKDOWN_NULL_STRING_LABEL } from 'scenes/insights/utils'
@@ -44,7 +44,8 @@ export function BreakdownsTileButton({ item }: BreakdownsTileButtonProps): JSX.E
}
function BreakdownPreview({ title, property }: { title: string; property: string }): JSX.Element {
- const { getBreakdownForProperty, responseLoading } = useValues(miniBreakdownsLogic)
+ const { getBreakdownForProperty, responseLoading, responseError } = useValues(miniBreakdownsLogic)
+ const { loadResponse } = useActions(miniBreakdownsLogic)
const { properties, totalCount } = getBreakdownForProperty(property)
const hasOnlyNullBreakdown = properties.length === 1 && properties[0].label === BREAKDOWN_NULL_STRING_LABEL
@@ -53,7 +54,19 @@ function BreakdownPreview({ title, property }: { title: string; property: string
<div className="flex items-center gap-2">
<div className="font-semibold text-xs w-[30%]">{title}</div>
<div className="w-[70%]">
- {responseLoading ? (
+ {responseError ? (
+ <Tooltip title={responseError}>
+ <button
+ className="text-danger text-xs h-4 flex items-center justify-center w-full underline decoration-dotted"
+ onClick={(e) => {
+ e.stopPropagation()
+ loadResponse()
+ }}
+ >
+ Failed to load, click to retry
+ </button>
+ </Tooltip>
+ ) : responseLoading ? (
<div className="h-4 flex items-center justify-center">
<LemonSkeleton />
</div>
diff --git a/products/error_tracking/frontend/components/Breakdowns/miniBreakdownsLogic.test.ts b/products/error_tracking/frontend/components/Breakdowns/miniBreakdownsLogic.test.ts
new file mode 100644
index 000000000000..ff60a082b342
--- /dev/null
+++ b/products/error_tracking/frontend/components/Breakdowns/miniBreakdownsLogic.test.ts
@@ -0,0 +1,32 @@
+import { useMocks } from '~/mocks/jest'
+import { initKeaTests } from '~/test/init'
+
+import { miniBreakdownsLogic } from './miniBreakdownsLogic'
+
+describe('miniBreakdownsLogic', () => {
+ let logic: ReturnType<typeof miniBreakdownsLogic.build>
+
+ beforeEach(() => {
+ useMocks({
+ post: {
+ '/api/environments/:team_id/query/': { results: {} },
+ },
+ })
+ initKeaTests()
+ logic = miniBreakdownsLogic({ issueId: 'issue-1' })
+ logic.mount()
+ })
+
+ afterEach(() => logic?.unmount())
+
+ // There used to be no loadResponseFailure reducer at all, so a failed breakdowns query left
+ // response/responseLoading unchanged — indistinguishable from "query returned nothing" and
+ // with no way to retry. It must surface the error and clear it on retry.
+ it('surfaces and clears a response load failure', () => {
+ logic.actions.loadResponseFailure('Failed to load breakdowns')
+ expect(logic.values.responseError).toBe('Failed to load breakdowns')
+
+ logic.actions.loadResponse()
+ expect(logic.values.responseError).toBeNull()
+ })
+})
diff --git a/products/error_tracking/frontend/components/Breakdowns/miniBreakdownsLogic.ts b/products/error_tracking/frontend/components/Breakdowns/miniBreakdownsLogic.ts
index eaef971fc6f2..533ace0197d1 100644
--- a/products/error_tracking/frontend/components/Breakdowns/miniBreakdownsLogic.ts
+++ b/products/error_tracking/frontend/components/Breakdowns/miniBreakdownsLogic.ts
@@ -1,4 +1,4 @@
-import { MakeLogicType, connect, events, kea, key, path, props, selectors } from 'kea'
+import { MakeLogicType, connect, events, kea, key, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { subscriptions } from 'kea-subscriptions'
import posthog from 'posthog-js'
@@ -34,6 +34,7 @@ export interface miniBreakdownsLogicValues {
totalCount: number
}
response: ErrorTrackingBreakdownsQueryResponse | null
+ responseError: string | null
responseLoading: boolean
}
@@ -81,6 +82,16 @@ export const miniBreakdownsLogic = kea<miniBreakdownsLogicType>([
connect(() => ({
values: [breakdownFiltersLogic, ['dateRange', 'filterTestAccounts']],
})),
+ reducers(() => ({
+ responseError: [
+ null as string | null,
+ {
+ loadResponse: () => null,
+ loadResponseSuccess: () => null,
+ loadResponseFailure: (_, { error }) => error,
+ },
+ ],
+ })),
loaders(({ props, values }) => ({
response: [
null as ErrorTrackingBreakdownsQueryResponse | null,