Skip to content

Commit aad1e65

Browse files
committed
feat(remix): Wrap root with ErrorBoundary.
1 parent 1e3ba37 commit aad1e65

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

packages/remix/README.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Sentry.init({
5757
});
5858
```
5959

60-
Also, wrap your Remix root, with Sentry's `ErrorBoundary` component to catch React component errors, and `withSentryRouteTracing` to get parameterized router transactions.
60+
Also, wrap your Remix root with `withSentryRouteTracing` to catch React component errors and to get parameterized router transactions.
6161

6262
```ts
6363
// root.tsx
@@ -71,24 +71,22 @@ import {
7171
ScrollRestoration,
7272
} from "@remix-run/react";
7373

74-
import { ErrorBoundary, withSentryRouteTracing } from "@sentry/remix";
74+
import { withSentryRouteTracing } from "@sentry/remix";
7575

7676
function App() {
7777
return (
78-
<ErrorBoundary>
79-
<html>
80-
<head>
81-
<Meta />
82-
<Links />
83-
</head>
84-
<body>
85-
<Outlet />
86-
<ScrollRestoration />
87-
<Scripts />
88-
<LiveReload />
89-
</body>
90-
</html>
91-
</ErrorBoundary>
78+
<html>
79+
<head>
80+
<Meta />
81+
<Links />
82+
</head>
83+
<body>
84+
<Outlet />
85+
<ScrollRestoration />
86+
<Scripts />
87+
<LiveReload />
88+
</body>
89+
</html>
9290
);
9391
}
9492

packages/remix/src/performance/client.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { withErrorBoundary } from '@sentry/react';
12
import { Transaction, TransactionContext } from '@sentry/types';
23
import { getGlobalObject, logger } from '@sentry/utils';
34
import * as React from 'react';
@@ -91,6 +92,7 @@ export function withSentryRouteTracing<P extends Record<string, unknown>, R exte
9192
// will break advanced type inference done by react router params
9293
return <OrigApp {...props} />;
9394
}
95+
9496
let isBaseLocation: boolean = false;
9597

9698
const location = _useLocation();
@@ -135,5 +137,5 @@ export function withSentryRouteTracing<P extends Record<string, unknown>, R exte
135137

136138
// @ts-ignore Setting more specific React Component typing for `R` generic above
137139
// will break advanced type inference done by react router params
138-
return SentryRoot;
140+
return withErrorBoundary(SentryRoot);
139141
}

0 commit comments

Comments
 (0)