Failed to load the correct optional catch all route (9.5.4)
See original GitHub issueBug report
Describe the bug
There are two routes in our project
[destintionName]/[[...params]]
- DestinationPage[desitntionName]/properties/[propertyId]/package/[[...params]]
- PackagePage
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
-
On DestinationPage
/cairns
-
Click
<Link href="/cairns/properties/123451/package" />
to go to PackagePage -
It updates browser url to
/cairns/properties/123451/package
Expected behavior
- Expects to go and load PackagePage, but it refreshes and load DestinationPage
It works on 9.5.3
System information
- OS: macOS
- Browser (if applies) chrome
- Version of Next.js: 9.5.4
- Version of Node.js: 10.16.3
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
You cannot define a route with the same specificity as ... - GitHub
The error you receive is intentional: You have an index route /index.js and an optional-catch all route ( /[[...rest]].js ) which are in ......
Read more >NextJS Optional catch all routes not working when deployed
The issue is, the optional catch-all are not workink properly whenever the pages are statically generated. Ex: productId/contentOne does not ...
Read more >Blog - Next.js 9.5
Production React Profiling: a new flag to measure your project's “cost” of rendering; Optional Catch All Routes: dynamic routes now provide more ...
Read more >Next.js Tutorial - 9 - Catch All Routes - YouTube
Courses - https://learn.codevolution.dev/⚡️ Checkout Taskade! https://www.taskade.com/ Support UPI - https://support.codevolution.dev/ ...
Read more >Client-Side Routing In Next.js - Smashing Magazine
Use catch-all alongside index routes, or optional catch-all routes alone. Avoid using catch-all and optional catch-all routes alongside. Routes ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, this appears to be working as expected on the latest canary of Next.js
v10.0.5-canary.3
, please update and give it a try!Thanks for the reproduction, it looks like this is from a conflict with the
basePath
config and the automatichref
resolving.To get around this for now you should be able to use the manual
href
andas
logic previously used for dynamic routes e.g.href="/[destinationName]/properties/[propertyId]/package" as="/cairns/properties/413969/package"