mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #523] [MERGED] feat: add ISR caching for App Router route handlers #643
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#643
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/523
Author: @NathanDrake2406
Created: 3/13/2026
Status: ✅ Merged
Merged: 3/14/2026
Merged by: @james-elicx
Base:
main← Head:feat/route-handler-isr-caching📝 Commits (7)
79e2606feat: add ISR caching for App Router route handlerse36a6b5chore: update entry-templates snapshots for route handler ISRcd83511test: add auto-HEAD ISR cache test for route handlersd4c52b5fix: review findings — force-dynamic guard, consistent header filtering in cache writes5015641test: poll for ISR background regen instead of fixed sleep7773123fix: capture request.url before regen closure to avoid pinning Request2b391b5fix: address remaining review findings📊 Changes
5 files changed (+953 additions, -14 deletions)
View changed files
📝
packages/vinext/src/entries/app-rsc-entry.ts(+115 -2)📝
tests/__snapshots__/entry-templates.test.ts.snap(+690 -12)📝
tests/app-router.test.ts(+130 -0)➕
tests/fixtures/app-basic/app/api/force-dynamic-revalidate/route.ts(+6 -0)📝
tests/nextjs-compat/app-routes.test.ts(+12 -0)📄 Description
Summary
export const revalidate = Nnow get server-side ISR caching (MISS → HIT → STALE with background regeneration), matching the existing page ISR behaviorCache-Controlheaders were emitted — the handler re-executed on every request with no server-side cache lookup or storeCachedRouteValuetype (kind: "APP_ROUTE") and KV serialization that were already defined but unusedImplementation
__isrRouteKeyhelper with"route"suffix for cache key construction (no HTML/RSC split needed)response.clone()+waitUntil— stores raw handler response before cookie/middleware transformsheaders()/cookies()), skips handlers that set ownCache-Control, filtersInfinityfromrevalidateSecondsTest Plan
__isrRouteKey,APP_ROUTEcache read/write in generated code)X-Vinext-Cacheheader in dev)app-router.test.tspass (no regressions to page ISR)app-routes.test.tspassisr-cache.test.ts+kv-cache-handler.test.tspass🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.