Skip to content

fix(react-router): resolve relative route matching inside root-level splat routes#30861

Merged
ShaneK merged 5 commits into
fix/react-router-6-pathsfrom
fix/react-router-6-splat-links
Dec 12, 2025
Merged

fix(react-router): resolve relative route matching inside root-level splat routes#30861
ShaneK merged 5 commits into
fix/react-router-6-pathsfrom
fix/react-router-6-splat-links

Conversation

@ShaneK

@ShaneK ShaneK commented Dec 11, 2025

Copy link
Copy Markdown
Member

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 computeParentPath function checks at root level for embedded wildcard routes (like tab1/*) 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?

  • Yes
  • No

Other information

Current dev build:

8.7.13-dev.11765477700.112ae0a3

@ShaneK ShaneK requested a review from a team as a code owner December 11, 2025 18:41
@ShaneK ShaneK requested review from thetaPC and removed request for a team December 11, 2025 18:41
@vercel

vercel Bot commented Dec 11, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
ionic-framework Ready Ready Preview Comment Dec 12, 2025 7:44pm

@thetaPC thetaPC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, minor suggestion

Comment thread packages/react-router/src/ReactRouter/ReactRouterViewStack.tsx
Comment thread packages/react-router/test/base/src/App.tsx

@thetaPC thetaPC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@brandyscarney brandyscarney left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good fix! 🥇

Comment thread packages/react-router/test/base/src/pages/Main.tsx
@ShaneK ShaneK merged commit 60cedf0 into fix/react-router-6-paths Dec 12, 2025
49 checks passed
@ShaneK ShaneK deleted the fix/react-router-6-splat-links branch December 12, 2025 19:53
@ShaneK

ShaneK commented Dec 15, 2025

Copy link
Copy Markdown
Member Author

@ptmkenny were you able to verify if this fixes your issue?

@ptmkenny

Copy link
Copy Markdown

@ShaneK I haven't been able to confirm this in my app yet because of other issues, some of which I think have been fixed in other PRs. My testing is also a little delayed due to the holiday period. Is there a new build of the main react-router 6 PR that includes all the fixes committed so far?

@ShaneK

ShaneK commented Dec 18, 2025

Copy link
Copy Markdown
Member Author

@ptmkenny Everything has been merged back into the main RR6 PR. The current dev build is 8.7.13-dev.11766090775.11e2bebb as of this afternoon, but that thread will generally be updated with the current dev build when fixes are added in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: react @ionic/react package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants