Skip to content

Commit 67b19cc

Browse files
huv1kclaude
andcommitted
chore: add render-error test button to sidebar
Add a second temporary PostHog validation button that throws during render (caught by the error boundary → posthog.captureException), alongside the existing handler-throw button (caught by capture_exceptions). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent c8f4da3 commit 67b19cc

2 files changed

Lines changed: 36 additions & 1 deletion

File tree

src/features/dashboard/sidebar/footer.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ import {
2424
} from '@/ui/primitives/sidebar'
2525
import DashboardSurveyPopover from '../navbar/dashboard-survey-popover'
2626
import ContactSupportDialog from '../navbar/report-issue-dialog'
27-
import { ThrowErrorTestButton } from './throw-error-test-button'
27+
import {
28+
RenderErrorTestButton,
29+
ThrowErrorTestButton,
30+
} from './throw-error-test-button'
2831

2932
export default function DashboardSidebarFooter() {
3033
return (
@@ -34,6 +37,7 @@ export default function DashboardSidebarFooter() {
3437
<SidebarMenu>
3538
{/* TEMPORARY: PostHog error-tracking validation (ENG-4261). Remove later. */}
3639
<ThrowErrorTestButton />
40+
<RenderErrorTestButton />
3741
<SidebarMenuItem key="github">
3842
<SidebarMenuButton asChild tooltip="GitHub">
3943
<Link

src/features/dashboard/sidebar/throw-error-test-button.tsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use client'
22

3+
import { useState } from 'react'
34
import { BugIcon } from '@/ui/primitives/icons'
45
import { SidebarMenuButton, SidebarMenuItem } from '@/ui/primitives/sidebar'
56

@@ -28,3 +29,33 @@ export function ThrowErrorTestButton() {
2829
</SidebarMenuItem>
2930
)
3031
}
32+
33+
/**
34+
* TEMPORARY — validates PostHog error tracking end-to-end (ENG-4261).
35+
*
36+
* Clicking flips state so the component throws on its next render. A render
37+
* error is caught by the nearest error boundary (error.tsx → the shared
38+
* ErrorBoundary), which reports it via posthog.captureException. This exercises
39+
* the boundary path, as opposed to ThrowErrorTestButton's uncaught-handler path.
40+
*
41+
* Remove this component (and its usage in the sidebar footer) once verified.
42+
*/
43+
export function RenderErrorTestButton() {
44+
const [shouldThrow, setShouldThrow] = useState(false)
45+
46+
if (shouldThrow) {
47+
throw new Error('PostHog error tracking test — thrown during render')
48+
}
49+
50+
return (
51+
<SidebarMenuItem key="render-error-test">
52+
<SidebarMenuButton
53+
tooltip="Throw render error"
54+
onClick={() => setShouldThrow(true)}
55+
>
56+
<BugIcon />
57+
Throw render error
58+
</SidebarMenuButton>
59+
</SidebarMenuItem>
60+
)
61+
}

0 commit comments

Comments
 (0)