mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[GH-ISSUE #438] Fetch cache stale-while-revalidate refetch not registered with waitUntil() #95
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#95
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?
Originally created by @Divkix on GitHub (Mar 11, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/438
Bug
When the fetch cache returns a stale entry, it fires a background refetch to refresh the cache. This refetch is fire-and-forget — the promise is not registered with
ExecutionContext.waitUntil().On Cloudflare Workers, once the Response is sent, the isolate terminates and kills the in-flight refetch. Stale entries never get refreshed.
Expected behavior
The background refetch promise should be registered with
waitUntil()so the Workers runtime keeps the isolate alive until the refetch completes, matching the pattern already used by ISR inisr-cache.ts.Reproduction
next: { revalidate: N })Relevant code
packages/vinext/src/shims/fetch-cache.tslines 583-617 — fire-and-forget refetchpackages/vinext/src/shims/isr-cache.tslines 110-111 — correct pattern usinggetRequestExecutionContext()?.waitUntil()