mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #1046] [MERGED] fix: support revalidate = false for App route segment config #1048
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#1048
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/1046
Author: @NathanDrake2406
Created: 5/4/2026
Status: ✅ Merged
Merged: 5/4/2026
Merged by: @james-elicx
Base:
main← Head:fix/issue-1041-revalidate-false📝 Commits (3)
095740dfix: support revalidate = false for App route segment config (#1041)9ef6046fix: exclude Infinity from route handler ISR read/write gates8769b95Update packages/vinext/src/build/report.ts📊 Changes
9 files changed (+122 additions, -13 deletions)
View changed files
📝
packages/vinext/src/build/report.ts(+8 -5)📝
packages/vinext/src/server/app-route-handler-policy.ts(+6 -3)📝
packages/vinext/src/server/app-route-handler-response.ts(+11 -1)📝
packages/vinext/src/server/app-segment-config.ts(+9 -3)📝
tests/app-route-handler-policy.test.ts(+15 -1)📝
tests/app-route-handler-response.test.ts(+17 -0)📝
tests/app-segment-config.test.ts(+28 -0)📝
tests/build-report.test.ts(+20 -0)➕
tests/fixtures/app-basic/app/revalidate-false-test/page.tsx(+8 -0)📄 Description
Fixes #1041
Summary
extractExportConstNumbernow matchesfalseand returnsInfinity, mappingexport const revalidate = falseto "cache indefinitely" — matching Next.js semantics wherefalsemeans "disable revalidation"resolveRevalidateSecondsinapp-segment-config.ts(introduced by #993) handlesrevalidate = false→Infinity, with correct shortest-wins: finite numeric intervals beatInfinitybecause any finite interval is shorter than foreverclassifyLayoutSegmentConfig,classifyAppRoute) correctly classifyrevalidate = falseasstaticgetAppRouteHandlerRevalidateSeconds) convertsfalsetoInfinityso ISR cache gates correctly enable indefinite cachingbuildRouteHandlerCacheControlemitsSTATIC_CACHE_CONTROLforInfinityinstead of a malformeds-maxage=InfinityheaderNext.js reference
Next.js segment config validation explicitly accepts
revalidate = falseas a valid value with the semantic "disable revalidation" (= cache indefinitely):AppSegmentConfigSchema—z.union([z.number().int().nonnegative(), z.literal(false)])AppSegmentConfig.revalidate—number | false"must be a non-negative number or false"Test plan
build-report.test.tsextractExportConstNumber(false),classifyLayoutSegmentConfig(false),classifyAppRoute(false)app-segment-config.test.tsfalse → Infinity, shortest-wins (layoutfalse+ page60), shortest-wins (layout60+ pagefalse)app-route-handler-policy.test.tsfalse → Infinity,Infinitycache read/write/header gatesapp-route-handler-response.test.tsInfinity→STATIC_CACHE_CONTROLfor cached response,Infinity→ static headerrevalidate-false-test/page.tsx🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.