-
Notifications
You must be signed in to change notification settings - Fork 13.4k
fix(react-router): resolve relative route matching inside root-level splat routes #30861
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(react-router): resolve relative route matching inside root-level splat routes #30861
Conversation
…c-framework into fix/react-router-6-splat-links
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
thetaPC
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, minor suggestion
...ages/react-router/test/base/src/pages/nested-tabs-relative-links/NestedTabsRelativeLinks.tsx
Show resolved
Hide resolved
thetaPC
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
brandyscarney
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good fix! 🥇
Issue number: resolves internal
What is the current behavior?
Routes with relative paths (e.g.,
path="tab1/*") inside root-level splat routes (path="*") do not match correctly. The parent path computation returns an incorrect value, causing routes to 404. Developers must use absolute paths (e.g.,path="/tab1/*") as a workaround.What is the new behavior?
Routes with relative paths now correctly match when the parent is a splat-only route. The
computeParentPathfunction checks at root level for embedded wildcard routes (liketab1/*) as a fallback when no match is found at deeper levels, allowing relative paths to work correctly inside splat route parents.Does this introduce a breaking change?
Other information
Current dev build: