Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[...catchall] takes precedence when navigating from /pages to /app #42532

Closed
1 task done
Winwardo opened this issue Nov 6, 2022 · 2 comments · Fixed by #43188
Closed
1 task done

[...catchall] takes precedence when navigating from /pages to /app #42532

Winwardo opened this issue Nov 6, 2022 · 2 comments · Fixed by #43188
Assignees
Labels
bug Issue was opened via the bug report template.

Comments

@Winwardo
Copy link

Winwardo commented Nov 6, 2022

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Running in Codesandbox, cannot run next info

"dependencies": {
"next": "13.0.3-canary.0",
"react": "18.3.0-next-4bd245e9e-20221104",
"react-dom": "18.3.0-next-4bd245e9e-20221104"
},

What browser are you using? (if relevant)

Chrome Version 107.0.5304.88 (Official Build) (64-bit)

How are you deploying your application? (if relevant)

Vercel

Describe the Bug

When navigating from a page in the legacy /pages directory to the new /app directory, a [...catchall] in /pages will take be resolved instead.

Expected Behavior

Navigating from /pages to /app should go to the correct page in /app.

Link to reproduction

https://codesandbox.io/s/catchall-bug-k7x8pi?file=/pages/%5B...catchall%5D.tsx

To Reproduce

Create a NextJS 13 application that uses both the legacy /pages directory and the new /app directory.
Create links that navigate between them.
Add a top level [...catchall] in the /pages directory.
Deploy to Vercel.
This bug does not happen in dev. I have yet to confirm if this happens on all next build && next start builds, or if only when deployed to Vercel.

Notice how when navigating between a page originating in /pages towards one in /app, instead the catchall page is hit.
Navigation between /pages to /pages, /app to /app or /app to /pages works as expected.

https://csb-k7x8pi-gweyxi0yg-winwardo.vercel.app/

@Winwardo Winwardo added the bug Issue was opened via the bug report template. label Nov 6, 2022
@hanneslund
Copy link
Contributor

This is the same issue as in #42513. As @timneutkens explains here #42513 (comment) the expected behaviour is for it to navigate to the catchall route.

#43188 makes sure it works the same in dev and prod.

@ijjk ijjk closed this as completed in d8d9b2c Nov 21, 2022
jankaifer pushed a commit to jankaifer/next.js that referenced this issue Nov 23, 2022
Currently in dev the `_devPagesManifest` includes the `/app` routes as
well. However, In production, the `_buildManifest.js` does not include
the `/app` routes. This causes the `/pages` router to behave differently
in the two environments.

This change excludes the `/app` routes from `_devPagesManifest` to make
it work the same in dev/prod.

Fixes vercel#42513
Fixes vercel#42532

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants