-
Notifications
You must be signed in to change notification settings - Fork 28.9k
Open
Labels
Linking and NavigatingRelated to Next.js linking (e.g., <Link>) and navigation.Related to Next.js linking (e.g., <Link>) and navigation.good first issueEasy to fix issues, good for newcomersEasy to fix issues, good for newcomers
Milestone
Description
Bug report
Describe the bug
While next is in dev mode, it fails to build appropriate catchall route when multiple catchalls exist with overlapping patterns. For example, a page at pages/[[...foo]].js/
will not be built if pages/[bar]/[[...bazz.js]]
exists, until first navigating to the homepage /
to force a build of [[...foo]]
To Reproduce
Created an example branch with this behavior
https://github.com/brandondc741/next-catchall-route-bug
Repro steps are located in https://github.com/brandondc741/next-catchall-route-bug/blob/master/HOW_TO_REPLICATE_ISSUE.md
npx next dev
- First visit /foo/root
- Observe 404
- visit /
- Observe page renders, [[...slug]] builds
- visit /foo/root
- Observe page now renders
Expected behavior
In dev mode, when next.js is given the path /foo/root
it should
- Attempt to render
pages/[firstSegment]/[[...nestedSlug]].js
- Fall-back to attempting to render
[[...slug]].js
System information
- OS: macOS
- Version of Next.js: 9.5.3
- Version of Node.js: 12.18.0
maidi29, tgrassl, lukeundtrug and martinsantibanez
Metadata
Metadata
Assignees
Labels
Linking and NavigatingRelated to Next.js linking (e.g., <Link>) and navigation.Related to Next.js linking (e.g., <Link>) and navigation.good first issueEasy to fix issues, good for newcomersEasy to fix issues, good for newcomers