Remove devCacheControlNoCache experimental option (hard-code no-cache)#91503
Merged
Conversation
Contributor
Tests Passed |
Contributor
Stats from current PR✅ No significant changes detected📊 All Metrics📖 Metrics GlossaryDev Server Metrics:
Build Metrics:
Change Thresholds:
⚡ Dev Server
📦 Dev Server (Webpack) (Legacy)📦 Dev Server (Webpack)
⚡ Production Builds
📦 Production Builds (Webpack) (Legacy)📦 Production Builds (Webpack)
📦 Bundle SizesBundle Sizes⚡ TurbopackClient Main Bundles
Server Middleware
Build DetailsBuild Manifests
📦 WebpackClient Main Bundles
Polyfills
Pages
Server Edge SSR
Middleware
Build DetailsBuild Manifests
Build Cache
🔄 Shared (bundler-independent)Runtimes
📝 Changed Files (1 file)Files with changes:
View diffsserver.runtime.prod.jsDiff too large to display 📎 Tarball URL |
timneutkens
approved these changes
Mar 17, 2026
Contributor
|
Allow CI Workflow Run
Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer |
Makes no-cache, must-revalidate the default dev Cache-Control header. The disabled test fixture now opts out explicitly with devCacheControlNoCache: false. Co-Authored-By: Claude <noreply@anthropic.com>
The no-cache, must-revalidate behavior is now unconditional in dev. Removes the config field, schema entry, type, default, and all conditional branches. Deletes the disabled test suite and renames the remaining test to drop the experimental framing. Co-Authored-By: Claude <noreply@anthropic.com>
Update all tests to expect no-cache instead of no-store in dev mode, and fix fallback-prefetch to not treat 304 Not Modified as a network error. Co-Authored-By: Claude <noreply@anthropic.com>
…st-revalidate` Cache-Control header, causing test failure in dev mode.
This commit fixes the issue reported at test/e2e/app-dir/ppr-full/ppr-full.test.ts:195
**Bug analysis:**
The PR removed the `experimental.devCacheControlNoCache` config option and hard-coded the dev server Cache-Control header to `no-cache, must-revalidate` (changed from the old default of `no-store, must-revalidate`). This change was applied across three server files:
- `packages/next/src/server/base-server.ts`
- `packages/next/src/server/route-modules/pages/pages-handler.ts`
- `packages/next/src/server/lib/router-server.ts`
A follow-up commit (716520a) updated numerous tests to expect the new `no-cache, must-revalidate` header value (visible in files like `custom-cache-control.test.ts`, `metadata.test.ts`, `dev-cache-control-no-cache.test.ts`, and `rendering.test.ts`). However, `test/e2e/app-dir/ppr-full/ppr-full.test.ts` at line 195 was missed — it's the **only** remaining instance of `no-store, must-revalidate` across the entire `test/` directory.
When the PPR full test suite runs in dev mode (`isNextDev === true`), it hits this assertion which expects the old `no-store, must-revalidate` header but the dev server now returns `no-cache, must-revalidate`, causing the test to fail.
**Fix:**
Changed line 195 from `expect(cacheControl).toEqual('no-store, must-revalidate')` to `expect(cacheControl).toEqual('no-cache, must-revalidate')` to match the new dev server behavior.
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: sokra <tobias.koppers@googlemail.com>
1a02a02 to
b7b3264
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Removes the
experimental.devCacheControlNoCacheconfig option entirely and hard-codesno-cache, must-revalidateas the dev serverCache-Controlheader value.Previously the option controlled whether the dev server responded with:
no-store, must-revalidate(default,false)no-cache, must-revalidate(opt-in,true)This PR first flips the default to
true, then removes the option altogether — makingno-cache, must-revalidateunconditional in all dev code paths.Why?
no-cacheis strictly better thanno-storefor the dev server:no-cacheallows the browser to revalidate (conditionalIf-None-Match/If-Modified-Sincerequests), letting the server respond with304 Not Modifiedwhen nothing changed → faster page loads during development.no-storeforces a full re-fetch every time, discarding valid cached responses.Since
no-cacheis the correct behavior for all dev users, the toggle has no remaining value and can be removed to simplify the codebase.How?
Two commits:
bcec825— Flip the default fromfalse→true; update tests/fixtures/manifest to reflect the new default.e6e919f— Remove the option entirely:devCacheControlNoCache?: booleanfromExperimentalConfiginterface,config-schema.tsZod schema,defaultConfig,NextConfigRuntime, andgetNextConfigRuntime().base-server.ts,router-server.ts,pages-handler.ts, andapp-page.tswith the hard-coded string'no-cache, must-revalidate'.dev-cache-control-no-cache-disabledtest suite (was testing thefalsepath which no longer exists).dev-cache-control-no-cachetest (removed experimental framing).rspack-dev-tests-manifest.json.