mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #544] [MERGED] fix: implement prefix-based invalidation for revalidatePath layout type #660
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#660
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/544
Author: @NathanDrake2406
Created: 3/15/2026
Status: ✅ Merged
Merged: 3/17/2026
Merged by: @james-elicx
Base:
main← Head:fix/revalidate-path-layout📝 Commits (9)
7b1af3ffix: implement prefix-based invalidation for revalidatePath with type layoutf69263efix: address review feedback for revalidatePath layout typec047bd4refactor: replace collectTagsByPathPrefix with revalidateByPathPrefix2cf1137fix: address PR review feedback — remove dead code, harden tag matching, add tests46de344refactor: replace O(n) prefix scanning with O(1) layout tag invalidation919bbbbfix: implement distinct page-type invalidation for revalidatePath3174332fix: double-slash in root page cache tag breaks revalidatePath("/", "page")d6defd0refactor: simplify revalidatePath and reduce comment noiseebecdbarefactor: simplify tag construction — reuse stem, eliminate tagBase ternary📊 Changes
4 files changed (+305 additions, -9 deletions)
View changed files
📝
packages/vinext/src/entries/app-rsc-entry.ts(+12 -0)📝
packages/vinext/src/shims/cache.ts(+16 -8)📝
tests/__snapshots__/entry-templates.test.ts.snap(+72 -0)📝
tests/isr-cache.test.ts(+205 -1)📄 Description
Summary
revalidatePath(path, 'layout')was ignoring thetypeparameter entirely — the_typeparam was declared but never readtype: "layout"invalidates the path AND all child pages beneath it (e.g.,revalidatePath('/dashboard', 'layout')also invalidates/dashboard/settings,/dashboard/profile)collectTagsByPathPrefixoptional method toCacheHandlerinterface, implemented onMemoryCacheHandler_isPathChildOfhelper (prevents false matches like/dashboardmatching/dashboard-admin)console.warnwhen layout invalidation degrades on handlers without prefix support (e.g., KVCacheHandler)next-shims.d.tstype declarationsTest plan
collectTagsByPathPrefiximplementation (follow-up PR — KV'slist()API supports prefix scanning)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.