Enable Server Components HMR cancellation by default

The `experimental.serverComponentsHmrCancellation` flag now defaults to
`true`, and the `__NEXT_EXPERIMENTAL_SERVER_COMPONENTS_HMR_CANCELLATION`
env-var opt-in is removed, along with the two Cache Components test
shards that exported it. The flag remains available for opting out.

Because the feature is now a default rather than an env-enabled
experiment, it no longer appears in the build output's list of
configured experiments, so the `build-output-prerender` snapshots drop
the `serverComponentsHmrCancellation` line.
parent ea1c09a2
...@@ -1002,7 +1002,6 @@ jobs: ...@@ -1002,7 +1002,6 @@ jobs:
afterBuild: | afterBuild: |
export __NEXT_CACHE_COMPONENTS=true export __NEXT_CACHE_COMPONENTS=true
export __NEXT_EXPERIMENTAL_CACHED_NAVIGATIONS=true export __NEXT_EXPERIMENTAL_CACHED_NAVIGATIONS=true
export __NEXT_EXPERIMENTAL_SERVER_COMPONENTS_HMR_CANCELLATION=true
export NEXT_EXTERNAL_TESTS_FILTERS="test/cache-components-tests-manifest.json" export NEXT_EXTERNAL_TESTS_FILTERS="test/cache-components-tests-manifest.json"
export NEXT_TEST_MODE=dev export NEXT_TEST_MODE=dev
export IS_TURBOPACK_TEST=1 export IS_TURBOPACK_TEST=1
...@@ -1038,7 +1037,6 @@ jobs: ...@@ -1038,7 +1037,6 @@ jobs:
afterBuild: | afterBuild: |
export __NEXT_CACHE_COMPONENTS=true export __NEXT_CACHE_COMPONENTS=true
export __NEXT_EXPERIMENTAL_CACHED_NAVIGATIONS=true export __NEXT_EXPERIMENTAL_CACHED_NAVIGATIONS=true
export __NEXT_EXPERIMENTAL_SERVER_COMPONENTS_HMR_CANCELLATION=true
export NEXT_EXTERNAL_TESTS_FILTERS="test/cache-components-tests-manifest.json" export NEXT_EXTERNAL_TESTS_FILTERS="test/cache-components-tests-manifest.json"
export NEXT_TEST_MODE=start export NEXT_TEST_MODE=start
export IS_TURBOPACK_TEST=1 export IS_TURBOPACK_TEST=1
......
...@@ -2163,7 +2163,7 @@ export const defaultConfig = Object.freeze({ ...@@ -2163,7 +2163,7 @@ export const defaultConfig = Object.freeze({
reactDebugChannel: true, reactDebugChannel: true,
staticGenerationRetryCount: undefined, staticGenerationRetryCount: undefined,
serverComponentsHmrCache: true, serverComponentsHmrCache: true,
serverComponentsHmrCancellation: false, serverComponentsHmrCancellation: true,
staticGenerationMaxConcurrency: 8, staticGenerationMaxConcurrency: 8,
staticGenerationMinPagesPerWorker: 25, staticGenerationMinPagesPerWorker: 25,
transitionIndicator: false, transitionIndicator: false,
......
...@@ -2234,26 +2234,6 @@ function enforceExperimentalFeatures( ...@@ -2234,26 +2234,6 @@ function enforceExperimentalFeatures(
} }
} }
// TODO: Remove this once serverComponentsHmrCancellation is the default.
if (
process.env.__NEXT_EXPERIMENTAL_SERVER_COMPONENTS_HMR_CANCELLATION ===
'true' &&
// We do respect an explicit value in the user config.
(config.experimental.serverComponentsHmrCancellation === undefined ||
(isDefaultConfig && !config.experimental.serverComponentsHmrCancellation))
) {
config.experimental.serverComponentsHmrCancellation = true
if (configuredExperimentalFeatures) {
addConfiguredExperimentalFeature(
configuredExperimentalFeatures,
'serverComponentsHmrCancellation',
true,
'enabled by `__NEXT_EXPERIMENTAL_SERVER_COMPONENTS_HMR_CANCELLATION`'
)
}
}
// Enable cachedNavigations by default when cacheComponents is enabled. // Enable cachedNavigations by default when cacheComponents is enabled.
// cachedNavigations relies on Cache Components rendering to do anything // cachedNavigations relies on Cache Components rendering to do anything
// useful, so the two features are tied together: we only flip the default // useful, so the two features are tied together: we only flip the default
......
...@@ -23,7 +23,6 @@ describe('build-output-prerender', () => { ...@@ -23,7 +23,6 @@ describe('build-output-prerender', () => {
- Cache Components enabled - Cache Components enabled
- Experiments (use with caution): - Experiments (use with caution):
✓ cachedNavigations (enabled by \`__NEXT_EXPERIMENTAL_CACHED_NAVIGATIONS\`) ✓ cachedNavigations (enabled by \`__NEXT_EXPERIMENTAL_CACHED_NAVIGATIONS\`)
✓ serverComponentsHmrCancellation (enabled by \`__NEXT_EXPERIMENTAL_SERVER_COMPONENTS_HMR_CANCELLATION\`)
· staticGenerationMaxConcurrency: 1" · staticGenerationMaxConcurrency: 1"
`) `)
} else if (isRspack) { } else if (isRspack) {
...@@ -153,7 +152,6 @@ describe('build-output-prerender', () => { ...@@ -153,7 +152,6 @@ describe('build-output-prerender', () => {
✓ allowDevelopmentBuild (enabled by \`--debug-prerender\`) ✓ allowDevelopmentBuild (enabled by \`--debug-prerender\`)
✓ cachedNavigations (enabled by \`__NEXT_EXPERIMENTAL_CACHED_NAVIGATIONS\`) ✓ cachedNavigations (enabled by \`__NEXT_EXPERIMENTAL_CACHED_NAVIGATIONS\`)
⨯ prerenderEarlyExit (disabled by \`--debug-prerender\`) ⨯ prerenderEarlyExit (disabled by \`--debug-prerender\`)
✓ serverComponentsHmrCancellation (enabled by \`__NEXT_EXPERIMENTAL_SERVER_COMPONENTS_HMR_CANCELLATION\`)
✓ serverSourceMaps (enabled by \`--debug-prerender\`) ✓ serverSourceMaps (enabled by \`--debug-prerender\`)
· staticGenerationMaxConcurrency: 1 · staticGenerationMaxConcurrency: 1
⨯ turbopackMinify (disabled by \`--debug-prerender\`)" ⨯ turbopackMinify (disabled by \`--debug-prerender\`)"
...@@ -358,8 +356,7 @@ describe('build-output-prerender', () => { ...@@ -358,8 +356,7 @@ describe('build-output-prerender', () => {
▲ Next.js x.y.z (Turbopack) ▲ Next.js x.y.z (Turbopack)
- Cache Components enabled - Cache Components enabled
- Experiments (use with caution): - Experiments (use with caution):
✓ cachedNavigations (enabled by \`__NEXT_EXPERIMENTAL_CACHED_NAVIGATIONS\`) ✓ cachedNavigations (enabled by \`__NEXT_EXPERIMENTAL_CACHED_NAVIGATIONS\`)"
✓ serverComponentsHmrCancellation (enabled by \`__NEXT_EXPERIMENTAL_SERVER_COMPONENTS_HMR_CANCELLATION\`)"
`) `)
} else if (isRspack) { } else if (isRspack) {
expect(getPreambleOutput(next.cliOutput)).toMatchInlineSnapshot(` expect(getPreambleOutput(next.cliOutput)).toMatchInlineSnapshot(`
...@@ -429,7 +426,6 @@ describe('build-output-prerender', () => { ...@@ -429,7 +426,6 @@ describe('build-output-prerender', () => {
✓ allowDevelopmentBuild (enabled by \`--debug-prerender\`) ✓ allowDevelopmentBuild (enabled by \`--debug-prerender\`)
✓ cachedNavigations (enabled by \`__NEXT_EXPERIMENTAL_CACHED_NAVIGATIONS\`) ✓ cachedNavigations (enabled by \`__NEXT_EXPERIMENTAL_CACHED_NAVIGATIONS\`)
⨯ prerenderEarlyExit (disabled by \`--debug-prerender\`) ⨯ prerenderEarlyExit (disabled by \`--debug-prerender\`)
✓ serverComponentsHmrCancellation (enabled by \`__NEXT_EXPERIMENTAL_SERVER_COMPONENTS_HMR_CANCELLATION\`)
✓ serverSourceMaps (enabled by \`--debug-prerender\`) ✓ serverSourceMaps (enabled by \`--debug-prerender\`)
⨯ turbopackMinify (disabled by \`--debug-prerender\`)" ⨯ turbopackMinify (disabled by \`--debug-prerender\`)"
`) `)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment