From 3352d32ee86d20b9ab1895e8c38f4d941bae37aa Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Mon, 16 Dec 2024 16:47:33 -0500 Subject: [PATCH] feat(react)!: Remove deprecated react router methods --- .../react-create-hash-router/src/index.tsx | 2 +- .../react-router-6-use-routes/src/index.tsx | 2 +- docs/migration/v8-to-v9.md | 5 ++++- packages/react/src/index.ts | 4 ---- packages/react/src/reactrouterv6.tsx | 12 ------------ 5 files changed, 6 insertions(+), 19 deletions(-) diff --git a/dev-packages/e2e-tests/test-applications/react-create-hash-router/src/index.tsx b/dev-packages/e2e-tests/test-applications/react-create-hash-router/src/index.tsx index 638f38e2a3c4..2ad9490ccd57 100644 --- a/dev-packages/e2e-tests/test-applications/react-create-hash-router/src/index.tsx +++ b/dev-packages/e2e-tests/test-applications/react-create-hash-router/src/index.tsx @@ -41,7 +41,7 @@ Sentry.init({ debug: !!process.env.DEBUG, }); -const sentryCreateHashRouter = Sentry.wrapCreateBrowserRouter(createHashRouter); +const sentryCreateHashRouter = Sentry.wrapCreateBrowserRouterV6(createHashRouter); const router = sentryCreateHashRouter([ { diff --git a/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/src/index.tsx b/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/src/index.tsx index b69dbff7dc48..3fe4310a8470 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/src/index.tsx +++ b/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/src/index.tsx @@ -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([ diff --git a/docs/migration/v8-to-v9.md b/docs/migration/v8-to-v9.md index 8dc83876e024..b798e315c960 100644 --- a/docs/migration/v8-to-v9.md +++ b/docs/migration/v8-to-v9.md @@ -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 diff --git a/packages/react/src/index.ts b/packages/react/src/index.ts index e72eb09645ec..9481e37789ec 100644 --- a/packages/react/src/index.ts +++ b/packages/react/src/index.ts @@ -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 { diff --git a/packages/react/src/reactrouterv6.tsx b/packages/react/src/reactrouterv6.tsx index 81afc2933861..6faaa2e6f65a 100644 --- a/packages/react/src/reactrouterv6.tsx +++ b/packages/react/src/reactrouterv6.tsx @@ -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. @@ -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.