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

Default Fallback Page Inside Parallel Routes Causes Infinite Reload in next dev #52342

Closed
1 task done
tj-noor opened this issue Jul 6, 2023 · 2 comments · Fixed by #52362
Closed
1 task done

Default Fallback Page Inside Parallel Routes Causes Infinite Reload in next dev #52342

tj-noor opened this issue Jul 6, 2023 · 2 comments · Fixed by #52362
Labels
bug Issue was opened via the bug report template. locked

Comments

@tj-noor
Copy link

tj-noor commented Jul 6, 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 22.5.0: Thu Jun  8 22:22:23 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6020
Binaries:
  Node: 18.16.0
  npm: 9.5.1
  Yarn: N/A
  pnpm: 8.6.5
Relevant Packages:
  next: 13.4.9-canary.2
  eslint-config-next: 13.4.8
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.1.6
Next.js Config:
  output: N/A

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

App Router

Link to the code that reproduces this issue or a replay of the bug

https://github.com/tnoor-co/next-infinite-parallel-refresh

To Reproduce

  1. install packages - pnpm install
  2. run next dev - pnpm dev
  3. navigate to http://localhost:3000/home/nested directly to experience the infinite refresh right away.
    • Timestamp will update on each render.
    • Server logs from the middleware will populate on each reload
  4. alternatively, navigate to http://localhost:3000/home/ and then click on the hard navigation and/or the next link for http://localhost:3000/home/nested
    • hard navigation link refreshes infinitely
    • next link behaves as expected and does not refresh infinitely

Reproduced with next@13.4.9-canary.2

app/
  - layout.tsx
  - page.tsx
  - @parallelA/
    - default.tsx
    - page.tsx
  - @parallelB/
    - page.tsx
    - nested/
      - page.tsx   <------- infinite reload here

Describe the Bug

During local development in next dev, a nested page inside of a parallel route without a corresponding matched route inside another parallel route causes an infinite reload, despite the required default file meant to render as a fallback.

ref:
#52061
#51951 (comment)

Expected Behavior

The page should only reload if changes were made to it or if the page returns a 404.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

@tj-noor tj-noor added the bug Issue was opened via the bug report template. label Jul 6, 2023
@tj-noor
Copy link
Author

tj-noor commented Jul 6, 2023

As a temporary workaround, I patched the following file in my project to avoid the fetch call IF "pong" event had invalid set to true ->

@kodiakhq kodiakhq bot closed this as completed in #52362 Jul 7, 2023
kodiakhq bot pushed a commit that referenced this issue Jul 7, 2023
### What?
HMR causes infinite reloads for parallel routes when the corresponding page component is nested

### Why?
In 4900fa2, code was added to remove `/@children` from the page path (if present) but in 59b3634, `normalizeParallelKey` removes the @ prefix from children, so this doesn't seem to be catching the scenario it was intended to prevent

### How?
This updates the existing replace logic to consider `/children/page` rather than `/@children/page` -- it doesn't seem like `/@children` is a valid scenario given the `normalizeParallelKey` behavior

Fixes #52342 and addresses the concerns in #52061 (comment)
@github-actions
Copy link
Contributor

github-actions bot commented Aug 6, 2023

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 added the locked label Aug 6, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 6, 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. locked
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant