next.js
ecf05d5b - fix: persist cacheControl for Pages Router ISR entries (#100495)

Commit
15 days ago
fix: persist cacheControl for Pages Router ISR entries (#100495) ### What? Fixed ISR cache lifetime persistence for Pages Router pages using the default `FileSystemCache` implementation. ### Why? Pages Router ISR cache entries did not persist their revalidation interval to disk. After restarting the server, the cache lifetime defaulted to 1 second instead of the configured `revalidate` value. As a result, previously generated pages could be treated as stale immediately after a restart, and the expected `Cache-Control` header was not preserved. This complements #99289, which addressed the same issue for the App Router, and covers the missing Pages Router case. See also #99288. ### How? - Persisted the cache lifetime when writing Pages Router cache entries to disk. - Restored the persisted cache lifetime when reading cache entries from disk. - Added a Pages Router test case to `test/production/app-dir/isr-cache-control-restart/` to verify cache behavior after a server restart. Before the fix, the test failed because the first request after restarting the server returned a `STALE` cache status instead of `HIT`. Verified that all 5 tests pass with both Turbopack and webpack using: - `pnpm test-start-turbo` - `pnpm test-start-webpack`
Author
Parents
Loading