question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to load the correct optional catch all route (9.5.4)

See original GitHub issue

Bug 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:

  1. On DestinationPage /cairns

  2. Click <Link href="/cairns/properties/123451/package" /> to go to PackagePage

  3. It updates browser url to /cairns/properties/123451/package

Expected behavior

  1. 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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ijjkcommented, Dec 30, 2020

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!

1reaction
ijjkcommented, Oct 12, 2020

Thanks for the reproduction, it looks like this is from a conflict with the basePath config and the automatic href resolving.

To get around this for now you should be able to use the manual href and as logic previously used for dynamic routes e.g. href="/[destinationName]/properties/[propertyId]/package" as="/cairns/properties/413969/package"

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found