Router Cache Staleness vs. staleTimes.dynamic: Trade-Off for Navigational Freshness in Next.js 15+
0 reputation · 17 Mar 2021, 15:21 UTC
0 reputation · 17 Mar 2021, 15:21 UTC
In Next.js 15+ App Router, users navigating back to a previously visited route may see outdated list items or timestamps instead of fresh server-rendered content. This stems from the Router Cache's per-segment payload storage in the browser session, which serves cached RSC responses on back-forward navigation without contacting the server. The concrete constraint balances instant navigational performance against data freshness when routes are revisited after mutations or time-sensitive updates.
In Next.js 15, dynamic segments are no longer stale by default, while static segments keep a longer caching window. Link prefetching can populate the Router Cache before user interaction, making staleness visible on first visits. The trade-off favors longer staleTime for navigation speed, or staleTimes.dynamic zero and no-store fetches for fresh payloads at the cost of perceived latency. Documentation does not prescribe a single correct choice, and the interaction between Route Cache, Data Cache, and Router Cache means disabling one layer does not alone ensure fresh output.
A thoughtful contribution can make all the difference. Be the first to share one.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.