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,27 +91,13 @@ function makeDynamicallyTrackedExoticParamsWithDevWarnings( ...@@ -91,27 +91,13 @@ function makeDynamicallyTrackedExoticParamsWithDevWarnings(
return proxiedPromise return proxiedPromise
} }
const noop = () => {} function warnForSyncAccess(expression: string) {
const warnForSyncAccess = process.env.__NEXT_DISABLE_SYNC_DYNAMIC_API_WARNINGS
? noop
: function warnForSyncAccess(expression: string) {
if (process.env.__NEXT_DISABLE_SYNC_DYNAMIC_API_WARNINGS) {
return
}
console.error( 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()\`.` `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
}
function warnForEnumeration(missingProperties: Array<string>) {
if (missingProperties.length) { if (missingProperties.length) {
const describedMissingProperties = const describedMissingProperties =
describeListOfPropertyNames(missingProperties) describeListOfPropertyNames(missingProperties)
...@@ -127,7 +113,7 @@ const warnForEnumeration = process.env.__NEXT_DISABLE_SYNC_DYNAMIC_API_WARNINGS ...@@ -127,7 +113,7 @@ const warnForEnumeration = process.env.__NEXT_DISABLE_SYNC_DYNAMIC_API_WARNINGS
`Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis` `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) {
const warnForSyncAccess = process.env.__NEXT_DISABLE_SYNC_DYNAMIC_API_WARNINGS
? noop
: function warnForSyncAccess(expression: string) {
if (process.env.__NEXT_DISABLE_SYNC_DYNAMIC_API_WARNINGS) {
return
}
console.error( console.error(
`A searchParam property was accessed directly with ${expression}. ` + `A searchParam property was accessed directly with ${expression}. ` +
`\`searchParams\` should be unwrapped with \`React.use()\` before accessing its properties. ` + `\`searchParams\` should be unwrapped with \`React.use()\` before accessing its properties. ` +
`Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis` `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
}
function warnForSyncSpread() {
console.error( console.error(
`The keys of \`searchParams\` were accessed directly. ` + `The keys of \`searchParams\` were accessed directly. ` +
`\`searchParams\` should be unwrapped with \`React.use()\` before accessing its properties. ` + `\`searchParams\` should be unwrapped with \`React.use()\` before accessing its properties. ` +
`Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis` `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 const warnForIncompleteEnumeration =
? noop createDedupedByCallsiteServerErrorLoggerDev(createIncompleteEnumerationError)
: createDedupedByCallsiteServerErrorLoggerDev(createSearchAccessError)
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