mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 00:09:23 +02:00
[PR #503] [MERGED] fix: MemoryCacheHandler revalidate:0 creates immediately-stale entries #625
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#625
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/503
Author: @NathanDrake2406
Created: 3/12/2026
Status: ✅ Merged
Merged: 3/12/2026
Merged by: @james-elicx
Base:
main← Head:fix/revalidate-zero-stale📝 Commits (2)
3ee7fd6fix: MemoryCacheHandler revalidate:0 creates immediately-stale entries05a3f89fix: revalidate:0 should skip cache storage entirely📊 Changes
5 files changed (+118 additions, -20 deletions)
View changed files
📝
packages/vinext/src/cloudflare/kv-cache-handler.ts(+13 -11)📝
packages/vinext/src/shims/cache.ts(+12 -5)📝
tests/features.test.ts(+48 -2)📝
tests/kv-cache-handler.test.ts(+43 -0)📝
tests/shims.test.ts(+2 -2)📄 Description
Summary
MemoryCacheHandler.sethad two code paths for computingrevalidateAt. Thectxpath guarded withrevalidate > 0, but thedatapath only checkedtypeof data.revalidate === "number"— lettingrevalidate: 0setrevalidateAt = Date.now(), creating immediately-stale entries.KVCacheHandlerwhich already had the> 0guard on both paths, meaning the two handlers produced different staleness for the same input (Memory → immediately stale, KV → no TTL).> 0guard toMemoryCacheHandler.setto align both code paths and both cache handler implementations.Test plan
data.revalidate:0does not create immediately-stale entriesdata.revalidate:0behaves consistently withctx.revalidate:0features.test.tssuite passes (252 tests)shims,fetch-cache,isr-cache,kv-cache-handler— 1063 tests)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.