Skip to content

fix(react): Don't rename a navigation span with another location's route - #24347

Open
logaretm wants to merge 2 commits into
developfrom
awad/react-router-stale-navigation-span-name
Open

fix(react): Don't rename a navigation span with another location's route#24347
logaretm wants to merge 2 commits into
developfrom
awad/react-router-stale-navigation-span-name

Conversation

@logaretm

@logaretm logaretm commented Sep 11, 2026

Copy link
Copy Markdown
Member

A navigation span could be renamed with a route belonging to a different navigation, shipping a transaction under a route that was never visited on it.

Each navigation span now records the pathname it was started for, and a rename is refused when the location being resolved doesn't match.

Surfaced by the Chromium 153 upgrade in #24273, which resolves routes early enough to hit this on an ordinary back navigation.

@github-actions

github-actions Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.96 kB - -
@sentry/browser - with treeshaking flags 27.26 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.15 kB - -
@sentry/browser (incl. Tracing) 50.51 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 50.52 kB - -
@sentry/browser (incl. Tracing, Profiling) 53.5 kB - -
@sentry/browser (incl. Tracing, Replay) 90.07 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 79.16 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 94.77 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 107.73 kB - -
@sentry/browser (incl. Feedback) 46.46 kB - -
@sentry/browser (incl. sendFeedback) 34.01 kB - -
@sentry/browser (incl. FeedbackAsync) 39.12 kB - -
@sentry/browser (incl. Metrics) 29.98 kB - -
@sentry/browser (incl. Logs) 30.24 kB - -
@sentry/browser (incl. Metrics & Logs) 30.91 kB - -
@sentry/react 30.72 kB - -
@sentry/react (incl. Tracing) 52.81 kB - -
@sentry/vue 36.2 kB - -
@sentry/vue (incl. Tracing) 52.76 kB - -
@sentry/svelte 28.98 kB - -
CDN Bundle 30.7 kB - -
CDN Bundle (incl. Tracing) 51.01 kB - -
CDN Bundle (incl. Logs, Metrics) 32.98 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 52.99 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 73.67 kB - -
CDN Bundle (incl. Tracing, Replay) 88.56 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 90.53 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 94.64 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 96.63 kB - -
CDN Bundle - uncompressed 90.83 kB - -
CDN Bundle (incl. Tracing) - uncompressed 152.33 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 97.41 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 158.29 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 226.82 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 271.9 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 277.85 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 285.6 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 291.54 kB - -
@sentry/nextjs (client) 55.13 kB - -
@sentry/sveltekit (client) 50.93 kB - -
@sentry/core/server 37.13 kB - -
@sentry/core/browser 13.66 kB - -
@sentry/node 129.82 kB +0.02% +22 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 81.83 kB - -
@sentry/node - without tracing 89.62 kB +0.04% +32 B 🔺
@sentry/node - without channel injection 108.7 kB +0.02% +21 B 🔺
@sentry/aws-serverless 97.83 kB +0.03% +21 B 🔺
@sentry/cloudflare (withSentry) - minified 203.36 kB - -
@sentry/cloudflare (withSentry) 506.44 kB - -

View base workflow run

React Router resolves the routes for a location around the time the SDK starts that navigation's
span, in either order, so a late resolution can hold the previous navigation's span while carrying
the next location's path. Renaming it there shipped a navigation span under a route that was never
visited on it.

Each navigation span now records the pathname it was started for, and a rename is refused when the
location being resolved does not match it. Keying this on the span rather than on whichever
navigation is currently tracked matters, since by the time a slow lazy handler resolves, the
tracker has usually moved on to the next span.
@logaretm
logaretm force-pushed the awad/react-router-stale-navigation-span-name branch from 00dc9f9 to 16d5d68 Compare September 11, 2026 18:15
@logaretm

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 698017d. Configure here.

@logaretm
logaretm marked this pull request as ready for review September 11, 2026 18:27
@logaretm
logaretm requested a review from a team as a code owner September 11, 2026 18:27
@logaretm
logaretm requested review from chargome, mydea and s1gr1d and removed request for a team September 11, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant