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

App router on PPR stop responding after navigate to path with query #69437

Closed
zamarawka opened this issue Aug 29, 2024 · 4 comments · Fixed by #69476
Closed

App router on PPR stop responding after navigate to path with query #69437

zamarawka opened this issue Aug 29, 2024 · 4 comments · Fixed by #69476
Labels
bug Issue was opened via the bug report template. linear: next Confirmed issue that is tracked by the Next.js team. locked Navigation Related to Next.js linking (e.g., <Link>) and navigation. Partial Prerendering (PPR) Related to Partial Prerendering.

Comments

@zamarawka
Copy link

zamarawka commented Aug 29, 2024

Link to the code that reproduces this issue

https://github.com/zamarawka/reproduction-app-router-bug

To Reproduce

  1. Build app for production npm run build
  2. Run app npm run start
  3. Go to localhost:3000/blog
  4. Try navigate via menu to "Tab: other" (it has path /?tab=other)
  5. Navigation doesn't happen (clicks on Links don't do anything) and router stop responding on any requests

Current vs. Expected behavior

I expect navigation work, pages changes, router responds to Link clicks

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.5.0: Wed May  1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 20.12.2
  npm: 10.5.0
  Yarn: 1.22.10
  pnpm: N/A
Relevant Packages:
  next: 15.0.0-canary.133 // There is a newer canary version (15.0.0-canary.134) available, please upgrade! 
  eslint-config-next: N/A
  react: 19.0.0-rc-f90a6bcc-20240827
  react-dom: 19.0.0-rc-f90a6bcc-20240827
  typescript: 5.3.3
Next.js Config:
  output: standalone

Which area(s) are affected? (Select all that apply)

Navigation, Partial Prerendering (PPR)

Which stage(s) are affected? (Select all that apply)

next build (local), next start (local)

Additional context

This case doesn't happen on dev mode, only after build and run app. Order of steps to reproduce is important, if you initially going to same page without query params (e.g. /) and start to navigate to query (/?tag=other) - everything works as expected.

App become broken after update from 15.0.0-canary.112 to latest canary version, probably any version next to 112 have such behaviour. Not sure, but it looks like #68340 relates.

Also found out that you can run from browser console:

window.next.router.refresh();

And app continue working, page updates, router start respond.

It tooks me a lot of time to figure out what going wrong and how to reproduce it. Looks like problem relates to dynamic (server-rendered on demand) pages with query params. I ended up my debugging with something going wrong in
navigateReducer.

@zamarawka zamarawka added the bug Issue was opened via the bug report template. label Aug 29, 2024
@github-actions github-actions bot added Navigation Related to Next.js linking (e.g., <Link>) and navigation. Partial Prerendering (PPR) Related to Partial Prerendering. labels Aug 29, 2024
@Alexandredc

This comment has been minimized.

@ztanner ztanner added the linear: next Confirmed issue that is tracked by the Next.js team. label Aug 30, 2024
@nicreaskdjasd
Copy link

@ztanner, Thank you for your fixes.I have tested with canary-136,the problem still exists for normal push, when not using PPR

@zamarawka
Copy link
Author

@ztanner, Thank you for your fixes.I have tested with canary-136,the problem still exists for normal push, when not using PPR

It seems like you need to open new issue.

Sam-Phillemon9493 pushed a commit to Sam-Phillemon9493/next.js that referenced this issue Sep 2, 2024
…9476)

I was previously incorrectly excluding aliased entries from flowing
through the PPR path. However, since accessing `searchParams` will
postpone, the aliased entry is safe to flow through the PPR branch. When
PPR is enabled and the non-PPR branch attempts to handle this
navigation, it won't know how to handle the postponed response.

Separately, I noticed that the PPR branch was not spawning a pending
task if the page segment contained search params, because it was
checking for strict equality, when in reality it'd be something like
`__PAGE__?{'foo':'bar'}`

Fixes vercel#69437
Closes NDX-255
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. 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 Sep 17, 2024
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. locked Navigation Related to Next.js linking (e.g., <Link>) and navigation. Partial Prerendering (PPR) Related to Partial Prerendering.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants