Skip to content

πŸ“¨ The ultimate agentic social media scheduling tool πŸ€–

fix(frontend): report React render crashes to Sentry from the crash screen

Gilad Resisic0bd447d9a2e
diff --git a/apps/frontend/src/app/global-error.tsx b/apps/frontend/src/app/global-error.tsx
index db4f81ebc..720d750d1 100644
--- a/apps/frontend/src/app/global-error.tsx
+++ b/apps/frontend/src/app/global-error.tsx
@@ -2,31 +2,17 @@
import * as Sentry from '@sentry/nextjs';
import NextError from 'next/error';
import { useEffect } from 'react';
-import { useVariables } from '@gitroom/react/helpers/variable.context';
export default function GlobalError({
error,
}: {
error: Error & { digest?: string };
}) {
- const { sentryDsn } = useVariables();
-
useEffect(() => {
- if (!sentryDsn) {
- return;
- }
- const eventId = Sentry.captureException(error);
- Sentry.showReportDialog({
- eventId,
- title: 'Something broke!',
- subtitle: 'Please help us fix the issue by providing some details.',
- labelComments: 'What happened?',
- labelName: 'Your name',
- labelEmail: 'Your email',
- labelSubmit: 'Send Report',
- lang: 'en',
- });
-
+ // The variables context is not mounted here (this replaces the root
+ // layout), so don't gate on its DSN. Without a client this is a no-op, and
+ // beforeSend already opens the report dialog for captured exceptions
+ Sentry.captureException(error);
}, [error]);
return (
<html>