File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,7 +24,10 @@ import {
2424} from '@/ui/primitives/sidebar'
2525import DashboardSurveyPopover from '../navbar/dashboard-survey-popover'
2626import 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
2932export 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
Original file line number Diff line number Diff line change 11'use client'
22
3+ import { useState } from 'react'
34import { BugIcon } from '@/ui/primitives/icons'
45import { 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+ }
You can’t perform that action at this time.
0 commit comments