mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[GH-ISSUE #415] isr: namespace cache keys by buildId or deploy version #93
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#93
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 10, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/415
Problem
ISR cache keys are currently formatted as
<router>:<pathname>(e.g.,pages:/about). When a new version of the app is deployed, the old cached entries may be served because the cache key hasn't changed. This can cause stale content from a previous build to be served to users.Proposed Solution
Include
buildIdin the ISR cache key format:<router>:<buildId>:<pathname>.The
buildIdis already available at runtime viaprocess.env.__VINEXT_BUILD_ID(injected by the Vite define plugin). The change is to pass it through toisrCacheKey()and include it in the generated key.This ensures that each deployment gets its own cache namespace, preventing stale cache reuse across deploys.
Acceptance Criteria
isrCacheKey()accepts optionalbuildIdparameterbuildIdis provided, key format is<router>:<buildId>:<pathname>buildId, format is unchanged (backward compat)buildIdstill hash correctly when exceeding length limitdev-server.ts,pages-server-entry.ts