mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #917] [MERGED] fix(app-router): Make revalidatePath expire route-scoped fetch cache reads #946
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#946
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/917
Author: @NathanDrake2406
Created: 4/27/2026
Status: ✅ Merged
Merged: 4/27/2026
Merged by: @james-elicx
Base:
main← Head:nathan/revalidate-path-fetch-soft-tags📝 Commits (1)
f7aaec5Make revalidatePath expire route-scoped fetch cache reads📊 Changes
8 files changed (+215 additions, -62 deletions)
View changed files
📝
packages/vinext/src/cloudflare/kv-cache-handler.ts(+77 -52)📝
packages/vinext/src/entries/app-rsc-entry.ts(+4 -1)📝
packages/vinext/src/shims/cache.ts(+13 -0)📝
packages/vinext/src/shims/fetch-cache.ts(+18 -2)📝
packages/vinext/src/shims/unified-request-context.ts(+1 -0)📝
tests/__snapshots__/entry-templates.test.ts.snap(+24 -6)📝
tests/fetch-cache.test.ts(+22 -1)📝
tests/kv-cache-handler.test.ts(+56 -0)📄 Description
What this changes
Route-scoped implicit tags are now threaded into App Router fetch cache reads as soft tags.
revalidatePath()can now force cachedfetch()results to miss while rendering the affected path, even when the fetch only usesnext.revalidateand no explicitnext.tags.Why
Before this change, vinext invalidated the page or route cache entry for a path, but the regenerated render could still reuse an older fetch cache entry because fetch entries only carried explicit
next.tags. Next.js treats page-derived implicit tags as read-time soft tags for fetch cache lookup:softTags: implicitTags?.tagstags + softTagsrevalidatePath()normalizes paths into_N_T_tagsApproach
Add request-scoped fetch soft tags and set them from the generated App Router entry after final route matching and inside ISR regeneration scopes. Pass those soft tags to fetch cache reads.
Memory and KV cache handlers now treat revalidated soft tags as read-time misses, but only stored entry tags trigger deletion. This keeps shared fetch entries from being permanently coupled to one route path while still matching the Next.js invalidation decision.
Validation
vp run vinext#buildvp test run tests/fetch-cache.test.ts tests/kv-cache-handler.test.ts tests/isr-cache.test.ts tests/entry-templates.test.tsvp checkRisks / follow-ups
This PR follows the existing vinext path-tag derivation helper. It does not broaden the scope to unrelated
revalidatePath()parity gaps, such as root/index alias handling.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.