Skip to content

Commit

Permalink
feat(react)!: Remove deprecated react router methods (#14743)
Browse files Browse the repository at this point in the history
Removes code deprecated in
#14513 and adds
changelog entry as appropriate:

Removed methods:
1. The `wrapUseRoutes` method has been removed. Use `wrapUseRoutesV6` or
`wrapUseRoutesV7` instead depending on what version of react router you
are using.
2. The `wrapCreateBrowserRouter` method has been removed. Use
`wrapCreateBrowserRouterV6` or `wrapCreateBrowserRouterV7` depending on
what version of react router you are using.
  • Loading branch information
AbhiPrasad authored Dec 17, 2024
1 parent ea49d5c commit d2b23d7
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Sentry.init({
debug: !!process.env.DEBUG,
});

const sentryCreateHashRouter = Sentry.wrapCreateBrowserRouter(createHashRouter);
const sentryCreateHashRouter = Sentry.wrapCreateBrowserRouterV6(createHashRouter);

const router = sentryCreateHashRouter([
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Sentry.init({
tunnel: 'http://localhost:3031', // proxy server
});

const useSentryRoutes = Sentry.wrapUseRoutes(useRoutes);
const useSentryRoutes = Sentry.wrapUseRoutesV6(useRoutes);

function App() {
return useSentryRoutes([
Expand Down
5 changes: 4 additions & 1 deletion docs/migration/v8-to-v9.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ It will be removed in a future major version.

## 4. Removal of Deprecated APIs (TODO)

TODO
### `@sentry/react`

- The `wrapUseRoutes` method has been removed. Use `wrapUseRoutesV6` or `wrapUseRoutesV7` instead depending on what version of react router you are using.
- The `wrapCreateBrowserRouter` method has been removed. Use `wrapCreateBrowserRouterV6` or `wrapCreateBrowserRouterV7` depending on what version of react router you are using.

## 5. Build Changes

Expand Down
4 changes: 0 additions & 4 deletions packages/react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ export {
export {
reactRouterV6BrowserTracingIntegration,
withSentryReactRouterV6Routing,
// eslint-disable-next-line deprecation/deprecation
wrapUseRoutes,
wrapUseRoutesV6,
// eslint-disable-next-line deprecation/deprecation
wrapCreateBrowserRouter,
wrapCreateBrowserRouterV6,
} from './reactrouterv6';
export {
Expand Down
12 changes: 0 additions & 12 deletions packages/react/src/reactrouterv6.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ export function wrapUseRoutesV6(origUseRoutes: UseRoutes): UseRoutes {
return createV6CompatibleWrapUseRoutes(origUseRoutes, '6');
}

/**
* Alias for backwards compatibility
* @deprecated Use `wrapUseRoutesV6` or `wrapUseRoutesV7` instead.
*/
export const wrapUseRoutes = wrapUseRoutesV6;

/**
* A wrapper function that adds Sentry routing instrumentation to a React Router v6 createBrowserRouter function.
* This is used to automatically capture route changes as transactions when using the createBrowserRouter API.
Expand All @@ -44,12 +38,6 @@ export function wrapCreateBrowserRouterV6<
return createV6CompatibleWrapCreateBrowserRouter(createRouterFunction, '6');
}

/**
* Alias for backwards compatibility
* @deprecated Use `wrapCreateBrowserRouterV6` or `wrapCreateBrowserRouterV7` instead.
*/
export const wrapCreateBrowserRouter = wrapCreateBrowserRouterV6;

/**
* A higher-order component that adds Sentry routing instrumentation to a React Router v6 Route component.
* This is used to automatically capture route changes as transactions.
Expand Down

0 comments on commit d2b23d7

Please sign in to comment.