[PR #923] [MERGED] fix(app-router): tag cached pages by route pattern #953

Closed
opened 2026-05-06 13:11:12 +02:00 by BreizhHardware · 0 comments

📋 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: mainHead: nathan/revalidate-path-pattern-tags


📝 Commits (1)

  • 92ec805 fix(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]/layout so layout-scoped invalidation reaches cached fetches beneath dynamic routes.

Refs #921

Approach

Move implicit tag construction into server/implicit-tags.ts and wire generated RSC entries to pass route.routeSegments plus 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.ts
  • vp check
  • vp run vinext#build

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/923 **Author:** [@NathanDrake2406](https://github.com/NathanDrake2406) **Created:** 4/28/2026 **Status:** ✅ Merged **Merged:** 4/29/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `nathan/revalidate-path-pattern-tags` --- ### 📝 Commits (1) - [`92ec805`](https://github.com/cloudflare/vinext/commit/92ec805ad2528bb8e8bc6747c5c5bd1d7befc7be) fix(app-router): tag cached pages by route pattern ### 📊 Changes **7 files changed** (+285 additions, -219 deletions) <details> <summary>View changed files</summary> 📝 `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) </details> ### 📄 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]/layout` so layout-scoped invalidation reaches cached fetches beneath dynamic routes. Refs #921 ## Approach Move implicit tag construction into `server/implicit-tags.ts` and wire generated RSC entries to pass `route.routeSegments` plus 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.ts` - `vp check` - `vp run vinext#build` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:11:12 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#953
No description provided.