Skip to content

Commit 0a59239

Browse files
committed
Rename to withSentry and deprecate withSentryRouteTracing.
1 parent fc33554 commit 0a59239

File tree

4 files changed

+25
-9
lines changed

4 files changed

+25
-9
lines changed

packages/remix/README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Sentry.init({
5757
});
5858
```
5959

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

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

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

7676
function App() {
7777
return (
@@ -90,20 +90,20 @@ function App() {
9090
);
9191
}
9292

93-
export default withSentryRouteTracing(App);
93+
export default withSentry(App);
9494
```
9595

96-
You can disable or configure `ErrorBoundary` using a second parameter to `withSentryRouteTracing`.
96+
You can disable or configure `ErrorBoundary` using a second parameter to `withSentry`.
9797

9898
```ts
9999

100-
withSentryRouteTracing(App, {
100+
withSentry(App, {
101101
wrapWithErrorBoundary: false
102102
});
103103

104104
// or
105105

106-
withSentryRouteTracing(App, {
106+
withSentry(App, {
107107
errorBoundaryOptions: {
108108
fallback: <p>An error has occurred</p>
109109
}

packages/remix/src/index.client.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { configureScope, init as reactInit, Integrations } from '@sentry/react';
33

44
import { buildMetadata } from './utils/metadata';
55
import { RemixOptions } from './utils/remixOptions';
6-
export { remixRouterInstrumentation, withSentryRouteTracing } from './performance/client';
6+
export { remixRouterInstrumentation, withSentry, withSentryRouteTracing } from './performance/client';
77
export { BrowserTracing } from '@sentry/tracing';
88
export * from '@sentry/react';
99

packages/remix/src/index.server.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { buildMetadata } from './utils/metadata';
77
import { RemixOptions } from './utils/remixOptions';
88

99
export { ErrorBoundary, withErrorBoundary } from '@sentry/react';
10-
export { remixRouterInstrumentation, withSentryRouteTracing } from './performance/client';
10+
export { remixRouterInstrumentation, withSentry, withSentryRouteTracing } from './performance/client';
1111
export { BrowserTracing, Integrations } from '@sentry/tracing';
1212
export * from '@sentry/node';
1313

packages/remix/src/performance/client.tsx

+17-1
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,27 @@ export function remixRouterInstrumentation(useEffect: UseEffect, useLocation: Us
7878
};
7979
}
8080

81+
/**
82+
* @deprecated Please use `withSentry` instead.
83+
*
84+
* Wraps a remix `root` (see: https://remix.run/docs/en/v1/guides/migrating-react-router-app#creating-the-root-route)
85+
* To enable pageload/navigation tracing on every route.
86+
*/
87+
export function withSentryRouteTracing<P extends Record<string, unknown>, R extends React.FC<P>>(App: R): R {
88+
// @ts-ignore Setting more specific React Component typing for `R` generic above
89+
// will break advanced type inference done by react router params
90+
return withSentry(App);
91+
}
92+
8193
/**
8294
* Wraps a remix `root` (see: https://remix.run/docs/en/v1/guides/migrating-react-router-app#creating-the-root-route)
8395
* To enable pageload/navigation tracing on every route.
96+
* Also wraps the application with `ErrorBoundary`.
97+
*
98+
* @param OrigApp The Remix root to wrap
99+
* @param options The options for ErrorBoundary wrapper.
84100
*/
85-
export function withSentryRouteTracing<P extends Record<string, unknown>, R extends React.FC<P>>(
101+
export function withSentry<P extends Record<string, unknown>, R extends React.FC<P>>(
86102
OrigApp: R,
87103
options: {
88104
wrapWithErrorBoundary?: boolean;

0 commit comments

Comments
 (0)