Unverified Commit 7e45ab1a authored by Zack Tanner's avatar Zack Tanner Committed by GitHub

remove dynamicIO flag (#84872)

This flag is now `experimental.cacheComponents`. We kept around the old
version with auto-migration, and now that we've had that around for some
time, we're dropping support for the configuration all together.
parent 6d59d11e
...@@ -1554,7 +1554,7 @@ export default async function getBaseWebpackConfig( ...@@ -1554,7 +1554,7 @@ export default async function getBaseWebpackConfig(
...getNextRootParamsRules({ ...getNextRootParamsRules({
isRootParamsEnabled: isRootParamsEnabled:
config.experimental.rootParams ?? config.experimental.rootParams ??
// `experimental.dynamicIO` implies `experimental.rootParams`. // `experimental.cacheComponents` implies `experimental.rootParams`.
config.experimental.cacheComponents ?? config.experimental.cacheComponents ??
false, false,
isClient, isClient,
......
...@@ -201,7 +201,6 @@ export const experimentalSchema = { ...@@ -201,7 +201,6 @@ export const experimentalSchema = {
disableOptimizedLoading: z.boolean().optional(), disableOptimizedLoading: z.boolean().optional(),
disablePostcssPresetEnv: z.boolean().optional(), disablePostcssPresetEnv: z.boolean().optional(),
cacheComponents: z.boolean().optional(), cacheComponents: z.boolean().optional(),
dynamicIO: z.boolean().optional(),
inlineCss: z.boolean().optional(), inlineCss: z.boolean().optional(),
esmExternals: z.union([z.boolean(), z.literal('loose')]).optional(), esmExternals: z.union([z.boolean(), z.literal('loose')]).optional(),
serverActions: z serverActions: z
......
...@@ -722,11 +722,6 @@ export interface ExperimentalConfig { ...@@ -722,11 +722,6 @@ export interface ExperimentalConfig {
*/ */
cacheComponents?: boolean cacheComponents?: boolean
/**
* @deprecated Use `experimental.cacheComponents` instead.
*/
dynamicIO?: boolean
/** /**
* Render <style> tags inline in the HTML for imported CSS assets. * Render <style> tags inline in the HTML for imported CSS assets.
* Supports app-router in production mode only. * Supports app-router in production mode only.
......
...@@ -197,66 +197,5 @@ describe('loadConfig', () => { ...@@ -197,66 +197,5 @@ describe('loadConfig', () => {
expect(result.experimental.rdcForNavigations).toBe(true) expect(result.experimental.rdcForNavigations).toBe(true)
}) })
it('migrates experimental.dynamicIO to experimental.cacheComponents', async () => {
process.env.__NEXT_VERSION = 'canary'
const result = await loadConfig(PHASE_PRODUCTION_BUILD, __dirname, {
customConfig: {
experimental: {
dynamicIO: true,
},
},
silent: true,
})
expect(result.experimental.cacheComponents).toBe(true)
expect(result.experimental.dynamicIO).toBeUndefined()
delete process.env.__NEXT_VERSION
})
it('preserves cacheComponents when both dynamicIO and cacheComponents are set', async () => {
process.env.__NEXT_VERSION = 'canary'
const result = await loadConfig(PHASE_PRODUCTION_BUILD, __dirname, {
customConfig: {
experimental: {
dynamicIO: true,
cacheComponents: false,
},
},
silent: true,
})
expect(result.experimental.cacheComponents).toBe(false)
expect(result.experimental.dynamicIO).toBeUndefined()
delete process.env.__NEXT_VERSION
})
it('warns when using deprecated experimental.dynamicIO', async () => {
process.env.__NEXT_VERSION = 'canary'
const consoleSpy = jest.spyOn(console, 'warn').mockImplementation()
await loadConfig(PHASE_PRODUCTION_BUILD, __dirname, {
customConfig: {
experimental: {
dynamicIO: true,
},
},
silent: false,
})
expect(consoleSpy).toHaveBeenCalledWith(
expect.stringContaining(
'`experimental.dynamicIO` has been renamed to `experimental.cacheComponents`'
)
)
consoleSpy.mockRestore()
delete process.env.__NEXT_VERSION
})
}) })
}) })
...@@ -130,15 +130,6 @@ function checkDeprecations( ...@@ -130,15 +130,6 @@ function checkDeprecations(
silent: boolean, silent: boolean,
dir: string dir: string
) { ) {
if (userConfig.experimental?.dynamicIO !== undefined) {
warnOptionHasBeenDeprecated(
userConfig,
'experimental.dynamicIO',
`\`experimental.dynamicIO\` has been renamed to \`experimental.cacheComponents\`. Please update your ${configFileName} file accordingly.`,
silent
)
}
warnOptionHasBeenDeprecated( warnOptionHasBeenDeprecated(
userConfig, userConfig,
'experimental.middlewarePrefetch', 'experimental.middlewarePrefetch',
...@@ -285,19 +276,6 @@ function assignDefaultsAndValidate( ...@@ -285,19 +276,6 @@ function assignDefaultsAndValidate(
delete (userConfig as any).exportTrailingSlash delete (userConfig as any).exportTrailingSlash
} }
// Handle migration of experimental.dynamicIO to experimental.cacheComponents
if (userConfig.experimental?.dynamicIO !== undefined) {
// If cacheComponents was not explicitly set by the user (i.e., it's still the default value),
// use the dynamicIO value. We check against the user config, not the merged result.
if (userConfig.experimental?.cacheComponents === undefined) {
userConfig.experimental.cacheComponents =
userConfig.experimental.dynamicIO
}
// Remove the deprecated property
delete userConfig.experimental.dynamicIO
}
const config = Object.keys(userConfig).reduce<{ [key: string]: any }>( const config = Object.keys(userConfig).reduce<{ [key: string]: any }>(
(currentConfig, key) => { (currentConfig, key) => {
const value = (userConfig as any)[key] const value = (userConfig as any)[key]
......
...@@ -108,7 +108,7 @@ function createPrerenderRootParamPromise( ...@@ -108,7 +108,7 @@ function createPrerenderRootParamPromise(
switch (prerenderStore.type) { switch (prerenderStore.type) {
case 'prerender': { case 'prerender': {
// We are in a dynamicIO prerender. // We are in a cacheComponents prerender.
// The param is a fallback, so it should be treated as dynamic. // The param is a fallback, so it should be treated as dynamic.
if ( if (
prerenderStore.fallbackRouteParams && prerenderStore.fallbackRouteParams &&
...@@ -123,7 +123,7 @@ function createPrerenderRootParamPromise( ...@@ -123,7 +123,7 @@ function createPrerenderRootParamPromise(
break break
} }
case 'prerender-ppr': { case 'prerender-ppr': {
// We aren't in a dynamicIO prerender, but the param is a fallback, // We aren't in a cacheComponents prerender, but the param is a fallback,
// so we need to make an erroring params object which will postpone/error if you access it // so we need to make an erroring params object which will postpone/error if you access it
if ( if (
prerenderStore.fallbackRouteParams && prerenderStore.fallbackRouteParams &&
...@@ -162,7 +162,7 @@ async function makeErroringRootParamPromise( ...@@ -162,7 +162,7 @@ async function makeErroringRootParamPromise(
// In most dynamic APIs, we also throw if `dynamic = "error"`. // In most dynamic APIs, we also throw if `dynamic = "error"`.
// However, root params are only dynamic when we're generating a fallback shell, // However, root params are only dynamic when we're generating a fallback shell,
// and even with `dynamic = "error"` we still support generating dynamic fallback shells. // and even with `dynamic = "error"` we still support generating dynamic fallback shells.
// TODO: remove this comment when dynamicIO is the default since there will be no `dynamic = "error"` // TODO: remove this comment when cacheComponents is the default since there will be no `dynamic = "error"`
switch (prerenderStore.type) { switch (prerenderStore.type) {
case 'prerender-ppr': { case 'prerender-ppr': {
return postponeWithTracking( return postponeWithTracking(
......
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