mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #369] [MERGED] fix: draftMode() must mark dynamic usage to prevent caching #517
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#517
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/369
Author: @NathanDrake2406
Created: 3/9/2026
Status: ✅ Merged
Merged: 3/9/2026
Merged by: @james-elicx
Base:
main← Head:fix/draft-mode-dynamic-usage📝 Commits (1)
5bf7f39fix: mark dynamic usage in draftMode() to prevent caching📊 Changes
2 files changed (+25 additions, -0 deletions)
View changed files
📝
packages/vinext/src/shims/headers.ts(+1 -0)📝
tests/nextjs-compat/draft-mode.test.ts(+24 -0)📄 Description
Summary
draftMode()reads the__prerender_bypasscookie (request-specific data) but did not callmarkDynamicUsage(), unlikeheaders()andcookies()draftMode().isEnabledcould have its output cached by ISR, serving draft content to regular users or stale content to draft usersmarkDynamicUsage()call and a test verifying the behaviorTest plan
draftMode() marks dynamic usage so the render is uncacheable— callsdraftMode()within a headers context and assertsconsumeDynamicUsage()returnstrue🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.