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

[NEXT-650] Renaming/removing on app dir page causes dev script to output the error modal on any subsequent requests #46379

Closed
1 task done
bruno12mota opened this issue Feb 24, 2023 · 1 comment · Fixed by #46583
Labels
bug Issue was opened via the bug report template. linear: next Confirmed issue that is tracked by the Next.js team.

Comments

@bruno12mota
Copy link

bruno12mota commented Feb 24, 2023

Verify canary release

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

Provide environment information

Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:01 PDT 2021; root:xnu-8019.41.5~1/RELEASE_ARM64_T6000
Binaries:
Node: 18.5.0
npm: 8.12.1
Yarn: 1.22.17
pnpm: 7.17.0
Relevant packages:
next: 13.2.1-canary.0
eslint-config-next: 13.2.1
react: 18.2.0
react-dom: 18.2.0

Which area(s) of Next.js are affected? (leave empty if unsure)

App directory (appDir: true), CLI (create-next-app), Routing (next/router, next/navigation, next/link)

Link to the code that reproduces this issue

https://github.com/bruno12mota/next-rename-bug

To Reproduce

  1. Run npm run dev
  2. Open app at http://localhost:3000/about
  3. Rename /src/app/about folder to something else like /src/app/aboutme
  4. Your browser at http://localhost:3000/about will now have a Failed to compile error
  5. Navigating to http://localhost:3000/aboutme or even http://localhost:3000/ will now output the same error

Describe the Bug

Using the experimental app dir if your page consumes a client component and a folder is renamed, the dev script enters an error state that you can't come out of, unless you restart the dev script, at which point it no longer errors and works normally.

In the git repo i create, the about route has a page that is consuming an about-content file which is a client component, without any client components this error doesn't happen from what i could tell.

Expected Behavior

I'd expect for the dev server to eventually reconcile the path change and not output the error modal on every request. Right now i have to restart the dev server every time i make a routing change.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

NEXT-650

@bruno12mota bruno12mota added the bug Issue was opened via the bug report template. label Feb 24, 2023
@timneutkens timneutkens added the linear: next Confirmed issue that is tracked by the Next.js team. label Feb 27, 2023
@timneutkens timneutkens changed the title Renaming/removing on app dir page causes dev script to output the error modal on any subsequent requests [NEXT-650] Renaming/removing on app dir page causes dev script to output the error modal on any subsequent requests Feb 27, 2023
@kodiakhq kodiakhq bot closed this as completed in #46583 Feb 28, 2023
kodiakhq bot pushed a commit that referenced this issue Feb 28, 2023
…46583)

Currently if a file or folder (that contains an entry) is renamed in app dir, the dev server will stop working because we never remove the old entry. Since all client entries in app dir are created as child entries programmatically via the RSC plugin, they're different and not handled by our existing hot reloader logic:

https://github.com/vercel/next.js/blob/f0cbe84e4c2ed159df70a926d2f8f23b4c1025c9/packages/next/src/server/dev/hot-reloader.ts#L666-L677

This PR adds a file path to child entries as well (it can be layout, page and other entries) so in the entry generation step we can prune the invalid ones.

Fixes #46379, fixes NEXT-650.

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/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`
- [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) 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`](https://github.com/vercel/next.js/blob/canary/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)
huozhi pushed a commit to huozhi/next.js that referenced this issue Feb 28, 2023
…ercel#46583)

Currently if a file or folder (that contains an entry) is renamed in app dir, the dev server will stop working because we never remove the old entry. Since all client entries in app dir are created as child entries programmatically via the RSC plugin, they're different and not handled by our existing hot reloader logic:

https://github.com/vercel/next.js/blob/f0cbe84e4c2ed159df70a926d2f8f23b4c1025c9/packages/next/src/server/dev/hot-reloader.ts#L666-L677

This PR adds a file path to child entries as well (it can be layout, page and other entries) so in the entry generation step we can prune the invalid ones.

Fixes vercel#46379, fixes NEXT-650.

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/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`
- [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) 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`](https://github.com/vercel/next.js/blob/canary/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 Mar 31, 2023
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. linear: next Confirmed issue that is tracked by the Next.js team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants