Skip to content

feat(react)!: Remove deprecated react router methods #14743

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading