Title: React Router v6 integration: `allRoutes` accumulates across independent/unrelated routers, causing incorrect transaction names · Issue #22782 · getsentry/sentry-javascript · GitHub
Open Graph Title: React Router v6 integration: `allRoutes` accumulates across independent/unrelated routers, causing incorrect transaction names · Issue #22782 · getsentry/sentry-javascript
X Title: React Router v6 integration: `allRoutes` accumulates across independent/unrelated routers, causing incorrect transaction names · Issue #22782 · getsentry/sentry-javascript
Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using the latest SDK release https://github.com/...
Open Graph Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
X Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/22782
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"React Router v6 integration: `allRoutes` accumulates across independent/unrelated routers, causing incorrect transaction names","articleBody":"### Is there an existing issue for this?\n\n- [x] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues\n- [x] I have reviewed the documentation https://docs.sentry.io/\n- [x] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases\n\n### How do you use Sentry?\n\nSentry Saas (sentry.io)\n\n### Which SDK are you using?\n\n@sentry/react-router\n\n### SDK Version\n\n10.68.0\n\n### Framework Version\n\n_No response_\n\n### Link to Sentry event\n\n_No response_\n\n### Reproduction Example/SDK Setup\n\n\n\nTwo independent router trees are each wrapped with Sentry's React Router\ninstrumentation (e.g. via `withSentryReactRouterV6Routing` /\n`wrapCreateBrowserRouter`), mounted at different points in the app's\nlifecycle, For example, one router for `/foo/:fooId` and a separate,\nunrelated router for `/bar/:barId`.\n\n```jsx\n// Router A\nconst RoutesA = () => (\n \u003cSentryRoutes>\n \u003cRoute path=\"/foo/:fooId\" element={\u003cFooPage />} />\n \u003c/SentryRoutes>\n);\n\n// Router B, mounted separately/later\nconst RoutesB = () => (\n \u003cSentryRoutes>\n \u003cRoute path=\"/bar/:barId\" element={\u003cBarPage />} />\n \u003c/SentryRoutes>\n);\n```\n\n**customer provided a full repro app. Link to that repo is included in internal Linear Issue to protect PII**\n\n### Steps to Reproduce\n\n\n1. Mount/navigate within Router A at `/foo/123`: transaction is correctly\n named `/foo/:fooId`.\n2. Mount/navigate within Router B at `/bar/456`.\n3. Observe the transaction name for the `/bar/456` navigation.\n\n### Expected Result\n\nTransaction name: `/bar/:barId`\n\n### Actual Result\n\n\n\nTransaction name is a hybrid/incorrect name such as `/bar/:fooId`\n\ni.e. the static segment from Router B's path combined with the param\nname from Router A's route.\n\n### Additional Context\n\n### Root cause (if I had to guess)\n\n`reactrouterv6-compat-utils.tsx` accumulates every route object it has\never seen into a module-level `allRoutes` Set, populated via\n`getChildRoutesRecursively` on each wrapped `\u003cRoutes>`'s mount effect,\nand never scoped to a router instance or cleared on unmount:\n\n```js\nroutes.forEach(route => {\n const extractedChildRoutes = getChildRoutesRecursively(route);\n extractedChildRoutes.forEach(r => {\n allRoutes.add(r);\n });\n});\n```\n\nThis was introduced to support descendant routes / multiple `\u003cRoutes>`\ntrees that are legitimately part of the *same* logical route tree (see\n#14304). But because `allRoutes` has no isolation between genuinely\nindependent router instances, once two unrelated routers have each been\nmounted once, `matchRoutes`/`rebuildRoutePathFromAllRoutes` operates on\nthe union of both, and can produce a name that mixes structure from one\nrouter with param names from another.\n\n\n\n### Priority\n\n\u003csub>React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it.\u003c/sub>","author":{"url":"https://github.com/masinette","@type":"Person","name":"masinette"},"datePublished":"2026-07-28T17:33:41Z","url":"https://github.com/getsentry/sentry-javascript/issues/22782"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:aa4f169e-deeb-b89d-dea1-6418fdac325c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A3C6:27737D:171D7D3:1F76560:6B040D6C |
| html-safe-nonce | a605aa0b477aee0d607794c5810a9fe9ef657b500c13dc81024649634a01a252 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBM0M2OjI3NzM3RDoxNzFEN0QzOjFGNzY1NjA6NkIwNDBENkMiLCJ2aXNpdG9yX2lkIjoiMzQzMzA3NTMyODM3NjExNDU0MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 0cff9c18e74aa7e98d00eaa11903779d2a095dbdbd32c8c446d28853b8799d57 |
| hovercard-subject-tag | issue:5001369645 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/22782/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d64ae5bd9f150df134e5d90e3844025c0a432c17f453e4ffc7b408134d507ee9/getsentry/sentry-javascript/issues/22782 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d64ae5bd9f150df134e5d90e3844025c0a432c17f453e4ffc7b408134d507ee9/getsentry/sentry-javascript/issues/22782 |
| og:image:alt | Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | masinette |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width