Unverified Commit 55f25fb2 authored by Sebastian "Sebbie" Silbermann's avatar Sebastian "Sebbie" Silbermann Committed by GitHub

Remove `internal_disableSyncDynamicAPIWarnings` flag (#75231)

parent a5d24dc7
...@@ -269,10 +269,6 @@ export function getDefineEnv({ ...@@ -269,10 +269,6 @@ export function getDefineEnv({
'process.env.__NEXT_LINK_NO_TOUCH_START': 'process.env.__NEXT_LINK_NO_TOUCH_START':
config.experimental.linkNoTouchStart ?? false, config.experimental.linkNoTouchStart ?? false,
'process.env.__NEXT_ASSET_PREFIX': config.assetPrefix, 'process.env.__NEXT_ASSET_PREFIX': config.assetPrefix,
'process.env.__NEXT_DISABLE_SYNC_DYNAMIC_API_WARNINGS':
// Internal only so untyped to avoid discovery
(config.experimental as any).internal_disableSyncDynamicAPIWarnings ??
false,
'process.env.__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS': 'process.env.__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS':
!!config.experimental.authInterrupts, !!config.experimental.authInterrupts,
...(isNodeOrEdgeCompilation ...(isNodeOrEdgeCompilation
......
...@@ -314,7 +314,6 @@ export const configSchema: zod.ZodType<NextConfig> = z.lazy(() => ...@@ -314,7 +314,6 @@ export const configSchema: zod.ZodType<NextConfig> = z.lazy(() =>
imgOptTimeoutInSeconds: z.number().int().optional(), imgOptTimeoutInSeconds: z.number().int().optional(),
imgOptMaxInputPixels: z.number().int().optional(), imgOptMaxInputPixels: z.number().int().optional(),
imgOptSequentialRead: z.boolean().optional().nullable(), imgOptSequentialRead: z.boolean().optional().nullable(),
internal_disableSyncDynamicAPIWarnings: z.boolean().optional(),
isrFlushToDisk: z.boolean().optional(), isrFlushToDisk: z.boolean().optional(),
largePageDataBytes: z.number().optional(), largePageDataBytes: z.number().optional(),
linkNoTouchStart: z.boolean().optional(), linkNoTouchStart: z.boolean().optional(),
......
...@@ -558,11 +558,9 @@ function syncIODev(route: string | undefined, expression: string) { ...@@ -558,11 +558,9 @@ function syncIODev(route: string | undefined, expression: string) {
warnForSyncAccess(route, expression) warnForSyncAccess(route, expression)
} }
const noop = () => {} const warnForSyncAccess = createDedupedByCallsiteServerErrorLoggerDev(
createCookiesAccessError
const warnForSyncAccess = process.env.__NEXT_DISABLE_SYNC_DYNAMIC_API_WARNINGS )
? noop
: createDedupedByCallsiteServerErrorLoggerDev(createCookiesAccessError)
function createCookiesAccessError( function createCookiesAccessError(
route: string | undefined, route: string | undefined,
......
...@@ -202,11 +202,9 @@ function syncIODev(route: string | undefined, expression: string) { ...@@ -202,11 +202,9 @@ function syncIODev(route: string | undefined, expression: string) {
warnForSyncAccess(route, expression) warnForSyncAccess(route, expression)
} }
const noop = () => {} const warnForSyncAccess = createDedupedByCallsiteServerErrorLoggerDev(
createDraftModeAccessError
const warnForSyncAccess = process.env.__NEXT_DISABLE_SYNC_DYNAMIC_API_WARNINGS )
? noop
: createDedupedByCallsiteServerErrorLoggerDev(createDraftModeAccessError)
function createDraftModeAccessError( function createDraftModeAccessError(
route: string | undefined, route: string | undefined,
......
...@@ -480,11 +480,9 @@ function syncIODev(route: string | undefined, expression: string) { ...@@ -480,11 +480,9 @@ function syncIODev(route: string | undefined, expression: string) {
warnForSyncAccess(route, expression) warnForSyncAccess(route, expression)
} }
const noop = () => {} const warnForSyncAccess = createDedupedByCallsiteServerErrorLoggerDev(
createHeadersAccessError
const warnForSyncAccess = process.env.__NEXT_DISABLE_SYNC_DYNAMIC_API_WARNINGS )
? noop
: createDedupedByCallsiteServerErrorLoggerDev(createHeadersAccessError)
function createHeadersAccessError( function createHeadersAccessError(
route: string | undefined, route: string | undefined,
......
...@@ -91,43 +91,29 @@ function makeDynamicallyTrackedExoticParamsWithDevWarnings( ...@@ -91,43 +91,29 @@ function makeDynamicallyTrackedExoticParamsWithDevWarnings(
return proxiedPromise return proxiedPromise
} }
const noop = () => {} function warnForSyncAccess(expression: string) {
console.error(
const warnForSyncAccess = process.env.__NEXT_DISABLE_SYNC_DYNAMIC_API_WARNINGS `A param property was accessed directly with ${expression}. \`params\` is now a Promise and should be unwrapped with \`React.use()\` before accessing properties of the underlying params object. In this version of Next.js direct access to param properties is still supported to facilitate migration but in a future version you will be required to unwrap \`params\` with \`React.use()\`.`
? noop )
: function warnForSyncAccess(expression: string) { }
if (process.env.__NEXT_DISABLE_SYNC_DYNAMIC_API_WARNINGS) {
return
}
console.error(
`A param property was accessed directly with ${expression}. \`params\` is now a Promise and should be unwrapped with \`React.use()\` before accessing properties of the underlying params object. In this version of Next.js direct access to param properties is still supported to facilitate migration but in a future version you will be required to unwrap \`params\` with \`React.use()\`.`
)
}
const warnForEnumeration = process.env.__NEXT_DISABLE_SYNC_DYNAMIC_API_WARNINGS
? noop
: function warnForEnumeration(missingProperties: Array<string>) {
if (process.env.__NEXT_DISABLE_SYNC_DYNAMIC_API_WARNINGS) {
return
}
if (missingProperties.length) { function warnForEnumeration(missingProperties: Array<string>) {
const describedMissingProperties = if (missingProperties.length) {
describeListOfPropertyNames(missingProperties) const describedMissingProperties =
console.error( describeListOfPropertyNames(missingProperties)
`params are being enumerated incompletely missing these properties: ${describedMissingProperties}. ` + console.error(
`\`params\` should be unwrapped with \`React.use()\` before using its value. ` + `params are being enumerated incompletely missing these properties: ${describedMissingProperties}. ` +
`Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis` `\`params\` should be unwrapped with \`React.use()\` before using its value. ` +
) `Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis`
} else { )
console.error( } else {
`params are being enumerated. ` + console.error(
`\`params\` should be unwrapped with \`React.use()\` before using its value. ` + `params are being enumerated. ` +
`Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis` `\`params\` should be unwrapped with \`React.use()\` before using its value. ` +
) `Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis`
} )
} }
}
function describeListOfPropertyNames(properties: Array<string>) { function describeListOfPropertyNames(properties: Array<string>) {
switch (properties.length) { switch (properties.length) {
......
...@@ -447,18 +447,12 @@ function syncIODev( ...@@ -447,18 +447,12 @@ function syncIODev(
} }
} }
const noop = () => {} const warnForSyncAccess = createDedupedByCallsiteServerErrorLoggerDev(
createParamsAccessError
)
const warnForSyncAccess = process.env.__NEXT_DISABLE_SYNC_DYNAMIC_API_WARNINGS const warnForIncompleteEnumeration =
? noop createDedupedByCallsiteServerErrorLoggerDev(createIncompleteEnumerationError)
: createDedupedByCallsiteServerErrorLoggerDev(createParamsAccessError)
const warnForIncompleteEnumeration = process.env
.__NEXT_DISABLE_SYNC_DYNAMIC_API_WARNINGS
? noop
: createDedupedByCallsiteServerErrorLoggerDev(
createIncompleteEnumerationError
)
function createParamsAccessError( function createParamsAccessError(
route: string | undefined, route: string | undefined,
......
...@@ -122,32 +122,18 @@ function makeUntrackedExoticSearchParams( ...@@ -122,32 +122,18 @@ function makeUntrackedExoticSearchParams(
return promise return promise
} }
const noop = () => {} function warnForSyncAccess(expression: string) {
console.error(
const warnForSyncAccess = process.env.__NEXT_DISABLE_SYNC_DYNAMIC_API_WARNINGS `A searchParam property was accessed directly with ${expression}. ` +
? noop `\`searchParams\` should be unwrapped with \`React.use()\` before accessing its properties. ` +
: function warnForSyncAccess(expression: string) { `Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis`
if (process.env.__NEXT_DISABLE_SYNC_DYNAMIC_API_WARNINGS) { )
return }
}
console.error(
`A searchParam property was accessed directly with ${expression}. ` +
`\`searchParams\` should be unwrapped with \`React.use()\` before accessing its properties. ` +
`Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis`
)
}
const warnForSyncSpread = process.env.__NEXT_DISABLE_SYNC_DYNAMIC_API_WARNINGS
? noop
: function warnForSyncSpread() {
if (process.env.__NEXT_DISABLE_SYNC_DYNAMIC_API_WARNINGS) {
return
}
console.error( function warnForSyncSpread() {
`The keys of \`searchParams\` were accessed directly. ` + console.error(
`\`searchParams\` should be unwrapped with \`React.use()\` before accessing its properties. ` + `The keys of \`searchParams\` were accessed directly. ` +
`Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis` `\`searchParams\` should be unwrapped with \`React.use()\` before accessing its properties. ` +
) `Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis`
} )
}
...@@ -716,18 +716,12 @@ function syncIODev( ...@@ -716,18 +716,12 @@ function syncIODev(
} }
} }
const noop = () => {} const warnForSyncAccess = createDedupedByCallsiteServerErrorLoggerDev(
createSearchAccessError
const warnForSyncAccess = process.env.__NEXT_DISABLE_SYNC_DYNAMIC_API_WARNINGS )
? noop
: createDedupedByCallsiteServerErrorLoggerDev(createSearchAccessError) const warnForIncompleteEnumeration =
createDedupedByCallsiteServerErrorLoggerDev(createIncompleteEnumerationError)
const warnForIncompleteEnumeration = process.env
.__NEXT_DISABLE_SYNC_DYNAMIC_API_WARNINGS
? noop
: createDedupedByCallsiteServerErrorLoggerDev(
createIncompleteEnumerationError
)
function createSearchAccessError( function createSearchAccessError(
route: string | undefined, route: string | undefined,
......
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