Open
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