mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #923] [MERGED] fix(app-router): tag cached pages by route pattern #953
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#953
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/923
Author: @NathanDrake2406
Created: 4/28/2026
Status: ✅ Merged
Merged: 4/29/2026
Merged by: @james-elicx
Base:
main← Head:nathan/revalidate-path-pattern-tags📝 Commits (1)
92ec805fix(app-router): tag cached pages by route pattern📊 Changes
7 files changed (+285 additions, -219 deletions)
View changed files
📝
knip.ts(+2 -2)📝
packages/vinext/src/entries/app-rsc-entry.ts(+14 -28)➕
packages/vinext/src/server/implicit-tags.ts(+62 -0)📝
tests/__snapshots__/entry-templates.test.ts.snap(+78 -168)📝
tests/app-router.test.ts(+12 -4)📝
tests/isr-cache.test.ts(+24 -17)➕
tests/page-cache-tags.test.ts(+93 -0)📄 Description
What this changes
App Router page and route handler cache entries now carry implicit tags derived from the matched route pattern in addition to exact resolved pathname tags.
Why
revalidatePath(path, type)targets_N_T_tags based on route files. Entries rendered at dynamic URLs need tags such as_N_T_/blog/[slug]/layoutso layout-scoped invalidation reaches cached fetches beneath dynamic routes.Refs #921
Approach
Move implicit tag construction into
server/implicit-tags.tsand wire generated RSC entries to passroute.routeSegmentsplus the leaf kind. The helper preserves exact pathname tags, root/index aliases, route groups, dynamic segments, page leaves, and route handler leaves.This is scoped to App Router cache tag generation and does not change ISR storage semantics.
Validation
vp test run tests/page-cache-tags.test.ts tests/isr-cache.test.ts tests/fetch-cache.test.ts -t "App Router page cache tags|revalidatePath|soft tags"vp test run tests/app-router.test.ts -t "generated code threads collected fetch tags into page ISR writes|generated code stores rscData in the ISR cache entry"vp test run tests/entry-templates.test.tsvp checkvp run vinext#build🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.