-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
[Bug]: layout routes shouldn't match their parent's path #8085
Comments
Just a heads up: your example where you reorder the routes is the same code as above. |
mjackson
added a commit
that referenced
this issue
Oct 3, 2021
This was fixed in 6ab98d3 and will be released in beta.6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of React Router are you using?
v6
Steps to Reproduce
Visit "/"
Expected Behavior
The index route should render. The layout shouldn't match.
Actual Behavior
The layout route renders!
At first I was thinking index routes just need to rank higher, but realized that a layout route, without any matching children, shouldn't even be matching in the first place.
<Layout/>
shouldn't match "/", it should only match "/privacy".If you reorder the routes it works:
But v6 is smarter than that.
A good test case might not involve index routes at all and just assert the layout route doesn't match if its child routes don't match.
The text was updated successfully, but these errors were encountered: