Problems with navigation and nested routes
See original GitHub issueHi, I’ve found some strange problems with navigation when you are using nested routes with params. I’m testing with the latest version 1.4.
How to reproduce?
Here is the link to the reproduction code: https://stackblitz.com/edit/react-raviger-test?file=index.js
Press on the links in the bottom part in that order to:
- nested with a param About (the route is loaded)
- nested with a param Test (the route is not loaded)
- root (the route is loaded)
- nested with a param Test (the route is loaded)
- root (the route is loaded)
- nested with a param Test (the route is loaded)
- nested with a param About (the route is not loaded)

Possible cause
I’ve checked many things, and I think the useLocationChange hook is the main suspect. It looks like the if condition with inheritBasePath option is causing the problem. I haven’t found any other place where this option is used internally.
I was trying to debug the code with breakpoints in browser devtools. After setting the value of basePath to what is provided with options the issue is gone:

Do you reckon we could somehow fix this behaviour? Maybe we just need to remove the inheritBasePath condition 😄 or force the false value when using hook internally from the useRoutes hook?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)

Top Related StackOverflow Question
@macku I released a beta which hopefully addresses this, see #51 for details
fix publishes under
1.4.1Thanks for all the research on this @macku, you made it a breeze to fix 😃