[PR #445] [MERGED] fix: App Router ISR invalidation parity for fetch and path tags #574

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

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/445
Author: @JaredStowell
Created: 3/11/2026
Status: Merged
Merged: 3/11/2026
Merged by: @james-elicx

Base: mainHead: jstowell/fix-app-router-isr-tag-invalidation


📝 Commits (3)

📊 Changes

5 files changed (+288 additions, -65 deletions)

View changed files

📝 packages/vinext/src/cloudflare/kv-cache-handler.ts (+4 -2)
📝 packages/vinext/src/entries/app-rsc-entry.ts (+21 -9)
📝 tests/__snapshots__/entry-templates.test.ts.snap (+126 -54)
📝 tests/app-router.test.ts (+73 -0)
📝 tests/kv-cache-handler.test.ts (+64 -0)

📄 Description

Fix App Router ISR page cache tagging so invalidation matches Next.js behavior more closely.

Previously, App Router page ISR entries in the generated RSC entry only stored tags: [], which meant:

  • revalidateTag() could not invalidate page cache entries by collected fetch tags
  • revalidatePath() did not have path tags attached to the same page entries

This change updates App Router page ISR writes to attach:

  • path tags: pathname and _N_T_${pathname}
  • collected fetch tags from the request render

That applies to:

  • initial HTML cache writes
  • initial RSC cache writes
  • background regeneration writes

Tests

Added/updated coverage for:

  • generated App Router entry code and snapshots
  • production App Router invalidation behavior for:
    • revalidateTag()
    • revalidatePath()

Verification

Ran:

  • pnpm test tests/app-router.test.ts tests/entry-templates.test.ts -u
  • pnpm run fmt
  • pnpm run typecheck

This closes the App Router ISR tagging gap so page cache entries participate in both tag-based and path-based invalidation.


🔄 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/445 **Author:** [@JaredStowell](https://github.com/JaredStowell) **Created:** 3/11/2026 **Status:** ✅ Merged **Merged:** 3/11/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `jstowell/fix-app-router-isr-tag-invalidation` --- ### 📝 Commits (3) - [`bd1e2b7`](https://github.com/cloudflare/vinext/commit/bd1e2b705c5144b2626731a95426af3a7ffbcdac) Fix App Router ISR tag parity - [`5c2908a`](https://github.com/cloudflare/vinext/commit/5c2908ab6b1cdbb771f03d351f162c02f5f2c60b) Fix KV tag persistence - [`19d97e6`](https://github.com/cloudflare/vinext/commit/19d97e683b03f4401debf0829127c5788d3ce53d) Fix KV cache tag handling ### 📊 Changes **5 files changed** (+288 additions, -65 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/cloudflare/kv-cache-handler.ts` (+4 -2) 📝 `packages/vinext/src/entries/app-rsc-entry.ts` (+21 -9) 📝 `tests/__snapshots__/entry-templates.test.ts.snap` (+126 -54) 📝 `tests/app-router.test.ts` (+73 -0) 📝 `tests/kv-cache-handler.test.ts` (+64 -0) </details> ### 📄 Description Fix App Router ISR page cache tagging so invalidation matches Next.js behavior more closely. Previously, App Router page ISR entries in the generated RSC entry only stored `tags: []`, which meant: - `revalidateTag()` could not invalidate page cache entries by collected fetch tags - `revalidatePath()` did not have path tags attached to the same page entries This change updates App Router page ISR writes to attach: - path tags: `pathname` and `_N_T_${pathname}` - collected fetch tags from the request render That applies to: - initial HTML cache writes - initial RSC cache writes - background regeneration writes ## Tests Added/updated coverage for: - generated App Router entry code and snapshots - production App Router invalidation behavior for: - `revalidateTag()` - `revalidatePath()` ## Verification Ran: - `pnpm test tests/app-router.test.ts tests/entry-templates.test.ts -u` - `pnpm run fmt` - `pnpm run typecheck` This closes the App Router ISR tagging gap so page cache entries participate in both tag-based and path-based invalidation. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:08:50 +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#574
No description provided.