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

NextJS router cache not persisting with query parameters present #75496

Open
hamidrezahanafi opened this issue Jan 30, 2025 · 2 comments
Open
Labels
Linking and Navigating Related to Next.js linking (e.g., <Link>) and navigation.

Comments

@hamidrezahanafi
Copy link

hamidrezahanafi commented Jan 30, 2025

Link to the code that reproduces this issue

https://github.com/hamidrezahanafi/nextjs-router-cache-bug

To Reproduce

  1. Dynamic Stale time set to 30
  2. Start the app and go to /link1
  3. Click on links with to link2?q=1
  4. Go back using the button to /link1
  5. Click again on link2?q=1 (exact same query param within the stale time) and RSC payload is being refetched
  6. This not happen with link with no query parameters

Current vs. Expected behavior

We should use NextJS router cache for links with query parameters

Provide environment information

Operating System: Mac
Next: 15.1.6
Node: 22

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

Linking and Navigating, Dynamic Routes, Route Handlers

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

next start (local)

Additional context

No response

@github-actions github-actions bot added Dynamic Routes Related to dynamic routes. Linking and Navigating Related to Next.js linking (e.g., <Link>) and navigation. Route Handlers Related to Route Handlers. labels Jan 30, 2025
@hamidrezahanafi
Copy link
Author

Found the root cause
It start happening on v15.0.0-canary.113
It's probably because of this commit

  • re-use loading from prefetch cache entries across searchParams: #68340

@samcx samcx removed Dynamic Routes Related to dynamic routes. Route Handlers Related to Route Handlers. labels Feb 5, 2025
@samcx
Copy link
Member

samcx commented Feb 5, 2025

@hamidrezahanafi Thank you for submitting an issue!

Taking a look—

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Linking and Navigating Related to Next.js linking (e.g., <Link>) and navigation.
Projects
None yet
Development

No branches or pull requests

2 participants