nextjs - 💡(How to fix) Fix Dynamic page incorrectly treated as static when query parameters are added – RSC payload not fetched on re-entry (prefetch via <Link>) [1 participants]

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#85841Fetched 2026-04-08 02:13:40
View on GitHub
Comments
0
Participants
1
Timeline
9
Reactions
5
Author
Participants
Timeline (top)
subscribed ×5unsubscribed ×2issue_type_added ×1labeled ×1

Root Cause

Because the page is declared dynamic (revalidate = 0), adding query parameters should not make it static or cached by the Router Cache. Each navigation should trigger a fresh RSC payload request.

Code Example

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.2.0: Fri Dec  6 18:51:28 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T8112
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 22.17.0
  npm: 10.9.2
  Yarn: 4.5.0
  pnpm: 10.7.0
Relevant Packages:
  next: 15.5.6
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.4.5
Next.js Config:
  output: N/A

---

experimental: {
  staleTimes: {
    dynamic: 0,
    static: 0,
  },
},
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://codesandbox.io/p/github/Donggggg/nextjs-router-cache-test-app/main

To Reproduce

1.Visit a dynamic page (e.g., /posts/[id]). → RSC payload is fetched as expected.

  1. Navigate to the same page with a query parameter (e.g., /posts/[id]?tab=recent).
  2. back
  3. Visit same page using <Link/> with prefetch

→ No RSC payload request is sent over the network. It appears to reuse a cached payload from the Router Cache.

However, if I start from the plain /posts/[id] page (without any query) or /posts/[id]?tab=recent (already have query) and re-enter it again via client navigation, the RSC payload is fetched every time as expected. So this behavior only happens after a query parameter was added.

Current vs. Expected behavior

Because the page is declared dynamic (revalidate = 0), adding query parameters should not make it static or cached by the Router Cache. Each navigation should trigger a fresh RSC payload request.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.2.0: Fri Dec  6 18:51:28 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T8112
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 22.17.0
  npm: 10.9.2
  Yarn: 4.5.0
  pnpm: 10.7.0
Relevant Packages:
  next: 15.5.6
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.4.5
Next.js Config:
  output: N/A

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

Dynamic Routes

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

Other (Deployed), next start (local)

Additional context

When I set the following experimental config:

experimental: {
  staleTimes: {
    dynamic: 0,
    static: 0,
  },
},

…the RSC payload is fetched on every navigation as expected (no cache reuse). That suggests the page was being mistakenly treated as static once query params were added, and the Router Cache then reused it on re-entry.

Additionally, when I disabled prefetch by setting prefetch={false} on the <Link> component and tested the same navigation scenario, the RSC payload was correctly requested again. This indicates that the issue only occurs when the navigation is prefetched and subsequently cached by the Router Cache.

extent analysis

TL;DR

Setting staleTimes to 0 in the experimental config or disabling prefetch on the <Link> component may resolve the issue of the Router Cache reusing a cached payload instead of fetching a fresh RSC payload.

Guidance

  • Verify that the issue is specific to dynamic routes with query parameters and prefetch enabled.
  • Try setting experimental.staleTimes.dynamic to 0 in the Next.js config to ensure the page is not treated as static when query parameters are added.
  • Disable prefetch on the <Link> component by setting prefetch={false} to see if it resolves the issue.
  • Test the navigation scenario with and without query parameters to confirm the issue is related to the Router Cache reusing a cached payload.

Example

No code snippet is provided as the issue is more related to configuration and component behavior.

Notes

The issue seems to be specific to the combination of dynamic routes, query parameters, and prefetch enabled. The provided experimental config and prefetch disabling workarounds suggest that the issue is related to the Router Cache behavior.

Recommendation

Apply workaround by setting experimental.staleTimes.dynamic to 0 in the Next.js config, as this resolves the issue without disabling prefetch entirely, allowing for better performance while ensuring fresh RSC payloads are fetched as expected.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING