nextjs - 💡(How to fix) Fix Redirecting to a static page with a revalidation time after entering draft mode shows stale content [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

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#84306Fetched 2026-04-08 02:19:57
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
2
Author
Participants
Timeline (top)
labeled ×3issue_type_added ×1subscribed ×1

Code Example

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sun Aug  6 20:05:33 UTC 2023
  Available memory (MB): 4102
  Available CPU cores: 2
Binaries:
  Node: 20.9.0
  npm: 9.8.1
  Yarn: 1.22.19
  pnpm: 8.10.2
Relevant Packages:
  next: 15.5.4 // Latest available version is detected (15.5.4).
  eslint-config-next: N/A
  react: 19.1.1
  react-dom: 19.1.1
  typescript: 5.3.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/next-draft-mode-with-revalidate-bug-9p7dtw

To Reproduce

  1. Start the application in production (pnpm build && pnpm start)
  2. Open Chrome devtools. Ensure caching is not disabled. Go to the cookies section in the Application tab.
  3. Toggle on draft mode by pressing the toggle button.
    • Observe that the beside text now says "enabled" and the __prerender_bypass cookie was set.
  4. Toggle off draft mode by pressing the toggle button again.
    • Observe that the beside text now say "disabled" and the __prerender_bypass cookie is gone.
  5. Toggle on draft mode again by pressing the toggle button.
    • Observe that the beside text still says "disabled", however the __prerender_bypass cookie was set.
    • Observe also that the second to last RSC request uses disk cache, rather than fetching fresh.

Current vs. Expected behavior

Current behavior:

  • Redirecting to a page with a custom revalidate config time causes stale content to show after entering draft mode.
    • In other words, it seems like Next isn't properly busting the cache before redirecting after entering draft mode if the RSC response has a stale-while-revalidate in its Cache-Control header.
  • It also seems like redirecting from a server function is erroneously performing a redundant navigation from the client.

https://github.com/user-attachments/assets/a69250f5-1f6b-4211-b8d0-b9a49ad08e95

Server Action ResponseRedundant Navigation Response
<img width="1059" height="314" alt="Image" src="https://github.com/user-attachments/assets/7360ccb1-c9da-4867-aca0-3fc9092d5531" /><img width="1059" height="314" alt="Image" src="https://github.com/user-attachments/assets/acdb060a-8b11-4bf7-ba62-2624f3991107" />

Expected behavior:

  • Entering draft mode and redirecting should bust/skip the cache completely and use a fresh RSC response.
  • There should not be an additional navigation after the server function completes and returns the updated UI.

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sun Aug  6 20:05:33 UTC 2023
  Available memory (MB): 4102
  Available CPU cores: 2
Binaries:
  Node: 20.9.0
  npm: 9.8.1
  Yarn: 1.22.19
  pnpm: 8.10.2
Relevant Packages:
  next: 15.5.4 // Latest available version is detected (15.5.4).
  eslint-config-next: N/A
  react: 19.1.1
  react-dom: 19.1.1
  typescript: 5.3.3
Next.js Config:
  output: N/A

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

Draft Mode, Server Actions, Linking and Navigating

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

next start (local), Vercel (Deployed)

Additional context

No response

extent analysis

TL;DR

  • The issue can be mitigated by ensuring that the revalidate config is properly set to bust the cache when entering draft mode.

Guidance

  • Review the revalidate config in the Next.js route segment config to ensure it is set to a low value or disabled when entering draft mode to prevent stale content.
  • Verify that the __prerender_bypass cookie is being set and removed correctly when toggling draft mode.
  • Check the Cache-Control header of the RSC response to ensure it is not causing the cache to be used instead of fetching a fresh response.
  • Investigate the server function to prevent redundant navigation after completing and returning the updated UI.

Example

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

Notes

  • The issue seems to be related to the caching behavior of Next.js when using draft mode and server actions.
  • The provided environment information and package versions may be relevant to the issue, but no specific version-related fixes are implied.

Recommendation

  • Apply workaround: Review and adjust the revalidate config and caching behavior to ensure that the cache is properly busted when entering draft mode, and investigate the server function to prevent redundant navigation.

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

nextjs - 💡(How to fix) Fix Redirecting to a static page with a revalidation time after entering draft mode shows stale content [1 participants]