From fb6c22ebb1399e706099279b6d6e092ce060aed3 Mon Sep 17 00:00:00 2001 From: Charly Gomez Date: Fri, 20 Dec 2024 17:40:43 +0100 Subject: [PATCH] docs(react): Update warning on react router library docs (#12189) --- .../javascript/guides/react/features/react-router/v6.mdx | 7 +++++-- .../javascript/guides/react/features/react-router/v7.mdx | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/platforms/javascript/guides/react/features/react-router/v6.mdx b/docs/platforms/javascript/guides/react/features/react-router/v6.mdx index dd7d8ad33507dc..edadb950fbcfe2 100644 --- a/docs/platforms/javascript/guides/react/features/react-router/v6.mdx +++ b/docs/platforms/javascript/guides/react/features/react-router/v6.mdx @@ -16,7 +16,10 @@ Update your `Sentry.browserTracingIntegration` to `Sentry.reactRouterV6BrowserTr -Make sure you call `Sentry.init`, **before** you wrap your `` component or the `useRoutes` hook. Otherwise, the routing instrumentation may not work properly. +To ensure proper routing instrumentation, initialize Sentry by calling `Sentry.init` **before**: +- Wrapping your `` component +- Using `useRoutes` +- Using `createBrowserRouterV6` @@ -56,7 +59,7 @@ Sentry.init({ }); const sentryCreateBrowserRouter = - Sentry.wrapCreateBrowserRouter(createBrowserRouter); + Sentry.wrapCreateBrowserRouterV6(createBrowserRouter); const router = sentryCreateBrowserRouter([ // your routes... diff --git a/docs/platforms/javascript/guides/react/features/react-router/v7.mdx b/docs/platforms/javascript/guides/react/features/react-router/v7.mdx index 4fb5e03929e4de..6f7fd6a3ae752b 100644 --- a/docs/platforms/javascript/guides/react/features/react-router/v7.mdx +++ b/docs/platforms/javascript/guides/react/features/react-router/v7.mdx @@ -17,7 +17,10 @@ Update your `Sentry.browserTracingIntegration` to `Sentry.reactRouterV7BrowserTr -Make sure you call `Sentry.init`, **before** you wrap your `` component or the `useRoutes` hook. Otherwise, the routing instrumentation may not work properly. +To ensure proper routing instrumentation, initialize Sentry by calling `Sentry.init` **before**: +- Wrapping your `` component +- Using `useRoutes` +- Using `createBrowserRouterV7`