fix(react): Don't rename a navigation span with another location's route - #24347
Merged
Merged
Conversation
Contributor
size-limit report 📦
|
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
force-pushed
the
awad/react-router-stale-navigation-span-name
branch
from
September 11, 2026 18:15
00dc9f9 to
16d5d68
Compare
Member
Author
|
bugbot run |
There was a problem hiding this comment.
✅ 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
marked this pull request as ready for review
September 11, 2026 18:27
logaretm
requested review from
chargome,
mydea and
s1gr1d
and removed request for
a team
September 11, 2026 18:27
chargome
approved these changes
Sep 14, 2026
chargome
left a comment
Member
There was a problem hiding this comment.
Could this be surfaced in e2e too in some way?
Navigating between two lazy route trees without waiting leaves the first navigation's span open while React Router resolves the second location's routes, which is the window where the rename used to land on the wrong span. The test asserts each navigation is reported under its own route.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.