Skip to content

Commit 41114a3

Browse files
Remove 'silence this warning' from instant validation fix output (#95187)
## What Removes the `silence this warning` phrasing from the structured fix lines in instant validation output: - `- [block] Set \`export const instant = false\` to ~~silence this warning and~~ allow a blocking route` - `- [ignore] Set \`export const instant = false\` to ~~silence this warning and~~ opt the route out of instant-navigation validation` - `- [ignore] Set \`export const instant = false\` to ~~silence this warning and~~ opt the dropped segment out of instant-navigation validation` ## Why The line called itself a warning while being logged via `Error:`. This PR originally renamed it to `silence this error`, but that has the mirror problem: at validation level `warning` or `manual-warning` (or when the check only surfaces in dev) nothing blocks, so "error" over-claims. The verb is also wrong either way. Setting `instant = false` doesn't silence a problem that still exists. It declares that blocking is acceptable for the route, so validation stops treating it as one. Removing the clause leaves wording that is correct at every validation level and matches the dev overlay cards ("Allow blocking route", "Disable validation on this route") and the docs sections the lines link to. ## How - `blocking-route-messages.ts`, `dynamic-rendering-utils.ts`: drop `silence this warning and` from the `[block]` lines - `instant-messages.ts`: drop it from the `[ignore]` lines (unrendered segment, link prefetch) - `errors.json`: regenerated, append-only (codes 1394-1405) - Storybook fixture and 15 test files updated to the new strings <!-- NEXT_JS_LLM_PR -->
1 parent 2aa1e45 commit 41114a3

26 files changed

Lines changed: 329 additions & 317 deletions

File tree

‎packages/next/.storybook/fixtures/errors.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ export const instantRuntimeDataErrors: ReadyRuntimeError[] = [
360360
runtime: true,
361361
error: Object.assign(
362362
new Error(
363-
'Route "/01-cookies-body": Next.js encountered runtime data during prerendering.\n\n`cookies()`, `headers()`, `params`, or `searchParams` accessed outside of `<Suspense>` prevents the route from being prerendered, blocking the page load and leading to a slower user experience.\n\nWays to fix this:\n - [stream] Provide a placeholder with `<Suspense fallback={...}>` around the data access\n - [cache] If the runtime data is `params` and they\'re known, prerender them with `generateStaticParams`\n - [block] Set `export const instant = false` to silence this warning and allow a blocking route\n\nLearn more: https://nextjs.org/docs/messages/blocking-route'
363+
'Route "/01-cookies-body": Next.js encountered runtime data during prerendering.\n\n`cookies()`, `headers()`, `params`, or `searchParams` accessed outside of `<Suspense>` prevents the route from being prerendered, blocking the page load and leading to a slower user experience.\n\nWays to fix this:\n - [stream] Provide a placeholder with `<Suspense fallback={...}>` around the data access\n - [cache] If the runtime data is `params` and they\'re known, prerender them with `generateStaticParams`\n - [block] Set `export const instant = false` to allow a blocking route\n\nLearn more: https://nextjs.org/docs/messages/blocking-route'
364364
),
365365
{ __NEXT_ERROR_CODE: 'E1221' }
366366
),
@@ -388,7 +388,7 @@ export const instantUncachedDataErrors: ReadyRuntimeError[] = [
388388
runtime: true,
389389
error: Object.assign(
390390
new Error(
391-
'Route "/06-uncached-fetch-body": Next.js encountered uncached data during prerendering.\n\n`fetch(...)` or `connection()` accessed outside of `<Suspense>` prevents the route from being prerendered, blocking the page load and leading to a slower user experience.\n\nWays to fix this:\n - [cache] Cache the data access with `"use cache"`\n - [stream] Provide a placeholder with `<Suspense fallback={...}>` around the data access\n - [block] Set `export const instant = false` to silence this warning and allow a blocking route\n\nLearn more: https://nextjs.org/docs/messages/blocking-route'
391+
'Route "/06-uncached-fetch-body": Next.js encountered uncached data during prerendering.\n\n`fetch(...)` or `connection()` accessed outside of `<Suspense>` prevents the route from being prerendered, blocking the page load and leading to a slower user experience.\n\nWays to fix this:\n - [cache] Cache the data access with `"use cache"`\n - [stream] Provide a placeholder with `<Suspense fallback={...}>` around the data access\n - [block] Set `export const instant = false` to allow a blocking route\n\nLearn more: https://nextjs.org/docs/messages/blocking-route'
392392
),
393393
{ __NEXT_ERROR_CODE: 'E1220' }
394394
),
@@ -416,7 +416,7 @@ export const instantViewportErrors: ReadyRuntimeError[] = [
416416
runtime: true,
417417
error: Object.assign(
418418
new Error(
419-
'Route "/14-cookies-in-viewport": Next.js encountered runtime data in `generateViewport()`.\n\n`cookies()`, `headers()`, `params`, or `searchParams` in `generateViewport()` prevents the page from being prerendered, leading to a slower user experience.\n\nWays to fix this:\n - [static] Use a static viewport export instead of `generateViewport()`\n - [block] Set `export const instant = false` to silence this warning and allow a blocking route\n\nLearn more: https://nextjs.org/docs/messages/blocking-prerender-viewport-runtime'
419+
'Route "/14-cookies-in-viewport": Next.js encountered runtime data in `generateViewport()`.\n\n`cookies()`, `headers()`, `params`, or `searchParams` in `generateViewport()` prevents the page from being prerendered, leading to a slower user experience.\n\nWays to fix this:\n - [static] Use a static viewport export instead of `generateViewport()`\n - [block] Set `export const instant = false` to allow a blocking route\n\nLearn more: https://nextjs.org/docs/messages/blocking-prerender-viewport-runtime'
420420
),
421421
{ __NEXT_ERROR_CODE: 'E1208' }
422422
),
@@ -447,7 +447,7 @@ export const instantViewportUncachedErrors: ReadyRuntimeError[] = [
447447
runtime: true,
448448
error: Object.assign(
449449
new Error(
450-
'Route "/15-fetch-in-viewport": Next.js encountered uncached data in `generateViewport()`.\n\n`fetch(...)` or `connection()` in `generateViewport()` prevents the page from being prerendered, leading to a slower user experience.\n\nWays to fix this:\n - [cache] Cache the viewport data with `"use cache"` in `generateViewport()`\n - [block] Set `export const instant = false` to silence this warning and allow a blocking route\n\nLearn more: https://nextjs.org/docs/messages/blocking-prerender-viewport-dynamic'
450+
'Route "/15-fetch-in-viewport": Next.js encountered uncached data in `generateViewport()`.\n\n`fetch(...)` or `connection()` in `generateViewport()` prevents the page from being prerendered, leading to a slower user experience.\n\nWays to fix this:\n - [cache] Cache the viewport data with `"use cache"` in `generateViewport()`\n - [block] Set `export const instant = false` to allow a blocking route\n\nLearn more: https://nextjs.org/docs/messages/blocking-prerender-viewport-dynamic'
451451
),
452452
{ __NEXT_ERROR_CODE: 'E1210' }
453453
),
@@ -672,7 +672,7 @@ export const mixedIssueAndInsightErrors: ReadyRuntimeError[] = [
672672
runtime: true,
673673
error: Object.assign(
674674
new Error(
675-
'Route "/nav-cookies-under-suspense": Next.js encountered runtime data during prerendering or a navigation.\n\n`cookies()`, `headers()`, `params`, or `searchParams` accessed outside of `<Suspense>` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience.\n\nWays to fix this:\n - [stream] Provide a placeholder with `<Suspense fallback={...}>` around the data access\n - [cache] If the runtime data is `params` and they\'re known, prerender them with `generateStaticParams`\n - [block] Set `export const instant = false` to silence this warning and allow a blocking route\n\nLearn more: https://nextjs.org/docs/messages/blocking-route'
675+
'Route "/nav-cookies-under-suspense": Next.js encountered runtime data during prerendering or a navigation.\n\n`cookies()`, `headers()`, `params`, or `searchParams` accessed outside of `<Suspense>` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience.\n\nWays to fix this:\n - [stream] Provide a placeholder with `<Suspense fallback={...}>` around the data access\n - [cache] If the runtime data is `params` and they\'re known, prerender them with `generateStaticParams`\n - [block] Set `export const instant = false` to allow a blocking route\n\nLearn more: https://nextjs.org/docs/messages/blocking-route'
676676
),
677677
{ __NEXT_ERROR_CODE: 'E1247' }
678678
),
@@ -697,7 +697,7 @@ export const mixedIssueAndInsightErrors: ReadyRuntimeError[] = [
697697
runtime: true,
698698
error: Object.assign(
699699
new Error(
700-
'Route "/nav-fetch-under-suspense": Next.js encountered uncached data during prerendering or a navigation.\n\n`fetch(...)` or `connection()` accessed outside of `<Suspense>` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience.\n\nWays to fix this:\n - [cache] Cache the data access with `"use cache"`\n - [stream] Provide a placeholder with `<Suspense fallback={...}>` around the data access\n - [block] Set `export const instant = false` to silence this warning and allow a blocking route\n\nLearn more: https://nextjs.org/docs/messages/blocking-route'
700+
'Route "/nav-fetch-under-suspense": Next.js encountered uncached data during prerendering or a navigation.\n\n`fetch(...)` or `connection()` accessed outside of `<Suspense>` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience.\n\nWays to fix this:\n - [cache] Cache the data access with `"use cache"`\n - [stream] Provide a placeholder with `<Suspense fallback={...}>` around the data access\n - [block] Set `export const instant = false` to allow a blocking route\n\nLearn more: https://nextjs.org/docs/messages/blocking-route'
701701
),
702702
{ __NEXT_ERROR_CODE: 'E1246' }
703703
),

‎packages/next/errors.json‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1391,5 +1391,17 @@
13911391
"1390": "Route \"%s\": Next.js encountered link data in \\`generateMetadata()\\`.\\n\\nThis route's metadata is blocked, but the rest of its content can be prefetched. \\`params\\` or \\`searchParams\\` accessed in \\`generateMetadata()\\` prevent it from being prefetched.\\n\\nWays to fix this:\\n - [static] Use a static metadata export instead of \\`generateMetadata()\\`\\n https://nextjs.org/docs/messages/blocking-prerender-metadata-runtime#use-static-metadata\\n - [dynamic] Render a marker component that calls \\`await connection()\\` inside \\`<Suspense>\\` on the page\\n https://nextjs.org/docs/messages/blocking-prerender-metadata-runtime#mark-the-route-as-dynamic",
13921392
"1391": "Route \"%s\": Next.js encountered link data during prerendering or a navigation.\\n\\n\\`params\\` or \\`searchParams\\` accessed outside of \\`<Suspense>\\` prevents the navigation from being instant, leading to a slower user experience.\\n\\nWays to fix this:\\n - [stream] Provide a placeholder with \\`<Suspense fallback={...}>\\` around the data access\\n https://nextjs.org/docs/messages/blocking-prerender-runtime#wrap-in-or-move-into-suspense\\n - [block] Set \\`export const instant = false\\` to silence this warning and allow a blocking route\\n https://nextjs.org/docs/messages/blocking-prerender-runtime#allow-blocking-route",
13931393
"1392": "Route \"%s\": Next.js encountered link data in \\`generateViewport()\\`.\\n\\n\\`params\\`, or \\`searchParams\\` in \\`generateViewport()\\` prevents the page from being prerendered, leading to a slower user experience.\\n\\nWays to fix this:\\n - [static] Use a static viewport export instead of \\`generateViewport()\\`\\n https://nextjs.org/docs/messages/blocking-prerender-viewport-runtime#use-static-viewport\\n - [block] Set \\`export const instant = false\\` to silence this warning and allow a blocking route\\n https://nextjs.org/docs/messages/blocking-prerender-viewport-runtime#allow-blocking-route",
1394-
"1393": "An unexpected error occurred during validation"
1394+
"1393": "An unexpected error occurred during validation",
1395+
"1394": "Next.js encountered dynamic data during prefetching for \"%s\".\\n\\nThis will lead to slower, more expensive prefetches.\\n\\nWays to fix this:\\n - [upgrade] Opt into Partial Prefetching by exporting \\`const prefetch = 'partial'\\` from the page or layout, or by setting \\`partialPrefetching: true\\` in next.config to opt the whole app in\\n https://nextjs.org/docs/messages/instant-link-prefetch-partial#opt-into-partial-prefetching\\n - [disable] Remove \\`prefetch={true}\\` from the <Link> to use the default prefetch\\n https://nextjs.org/docs/messages/instant-link-prefetch-partial#use-the-default-prefetch\\n - [ignore] Set \\`export const instant = false\\` to opt the route out of instant-navigation validation\\n https://nextjs.org/docs/messages/instant-link-prefetch-partial#disable-validation-on-this-route",
1396+
"1395": "Route \"%s\": Next.js encountered uncached data in \\`generateViewport()\\`.\\n\\n\\`fetch(...)\\` or \\`connection()\\` in \\`generateViewport()\\` prevents the page from being prerendered, leading to a slower user experience.\\n\\nWays to fix this:\\n - [cache] Cache the viewport data with \\`\"use cache\"\\` in \\`generateViewport()\\` (does not apply to \\`connection()\\`)\\n https://nextjs.org/docs/messages/blocking-prerender-viewport-dynamic#cache-the-viewport-data\\n - [block] Set \\`export const instant = false\\` to allow a blocking route\\n https://nextjs.org/docs/messages/blocking-prerender-viewport-dynamic#allow-blocking-route",
1397+
"1396": "Route \"%s\": Next.js encountered link data in \\`generateViewport()\\`.\\n\\n\\`params\\`, or \\`searchParams\\` in \\`generateViewport()\\` prevents the page from being prerendered, leading to a slower user experience.\\n\\nWays to fix this:\\n - [static] Use a static viewport export instead of \\`generateViewport()\\`\\n https://nextjs.org/docs/messages/blocking-prerender-viewport-runtime#use-static-viewport\\n - [block] Set \\`export const instant = false\\` to allow a blocking route\\n https://nextjs.org/docs/messages/blocking-prerender-viewport-runtime#allow-blocking-route",
1398+
"1397": "Route \"%s\": Next.js encountered uncached or runtime data during prerendering.\\n\\n\\`fetch(...)\\`, \\`cookies()\\`, \\`headers()\\`, \\`params\\`, \\`searchParams\\`, or \\`connection()\\` accessed outside of \\`<Suspense>\\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience.\\n\\nWays to fix this:\\n - [stream] Provide a placeholder with \\`<Suspense fallback={...}>\\` around the data access\\n https://nextjs.org/docs/messages/blocking-prerender-dynamic#wrap-in-or-move-into-suspense\\n - [cache] For uncached data (\\`fetch\\`, database calls): cache the access with \\`\"use cache\"\\` (does not apply to \\`connection()\\`)\\n https://nextjs.org/docs/messages/blocking-prerender-dynamic#cache-the-component-or-data\\n - [block] Set \\`export const instant = false\\` to allow a blocking route\\n https://nextjs.org/docs/messages/blocking-prerender-dynamic#allow-blocking-route",
1399+
"1398": "Route \"%s\": Next.js encountered uncached data during prerendering or a navigation.\\n\\n\\`fetch(...)\\` or \\`connection()\\` accessed outside of \\`<Suspense>\\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience.\\n\\nWays to fix this:\\n - [stream] Provide a placeholder with \\`<Suspense fallback={...}>\\` around the data access\\n https://nextjs.org/docs/messages/blocking-prerender-dynamic#wrap-in-or-move-into-suspense\\n - [cache] Cache the data access with \\`\"use cache\"\\` (does not apply to \\`connection()\\`)\\n https://nextjs.org/docs/messages/blocking-prerender-dynamic#cache-the-component-or-data\\n - [block] Set \\`export const instant = false\\` to allow a blocking route\\n https://nextjs.org/docs/messages/blocking-prerender-dynamic#allow-blocking-route",
1400+
"1399": "Route \"%s\": Next.js encountered uncached or runtime data in \\`generateViewport()\\`.\\n\\nThis prevents the page from being prerendered, leading to a slower user experience. Unlike metadata, viewport cannot be streamed behind \\`<Suspense>\\` because it affects the initial page load.\\n\\nWays to fix this:\\n - [static] Use a static viewport export instead of \\`generateViewport()\\`\\n https://nextjs.org/docs/messages/blocking-prerender-viewport-runtime#use-static-viewport\\n - [cache] For uncached data (\\`fetch\\`, database calls): cache the viewport with \\`\"use cache\"\\` in \\`generateViewport()\\` (does not apply to \\`connection()\\`)\\n https://nextjs.org/docs/messages/blocking-prerender-viewport-dynamic#cache-the-viewport-data\\n - [block] Set \\`export const instant = false\\` to allow a blocking route\\n https://nextjs.org/docs/messages/blocking-prerender-viewport-dynamic#allow-blocking-route",
1401+
"1400": "Route \"%s\": Next.js encountered runtime data during prerendering.\\n\\n\\`cookies()\\`, \\`headers()\\`, \\`params\\`, or \\`searchParams\\` accessed outside of \\`<Suspense>\\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience.\\n\\nWays to fix this:\\n - [stream] Provide a placeholder with \\`<Suspense fallback={...}>\\` around the data access\\n https://nextjs.org/docs/messages/blocking-prerender-runtime#wrap-in-or-move-into-suspense\\n - [block] Set \\`export const instant = false\\` to allow a blocking route\\n https://nextjs.org/docs/messages/blocking-prerender-runtime#allow-blocking-route",
1402+
"1401": "Route \"%s\": Next.js encountered uncached data during prerendering.\\n\\n\\`fetch(...)\\` or \\`connection()\\` accessed outside of \\`<Suspense>\\` prevents the route from being prerendered, blocking the page load and leading to a slower user experience.\\n\\nWays to fix this:\\n - [stream] Provide a placeholder with \\`<Suspense fallback={...}>\\` around the data access\\n https://nextjs.org/docs/messages/blocking-prerender-dynamic#wrap-in-or-move-into-suspense\\n - [cache] Cache the data access with \\`\"use cache\"\\` (does not apply to \\`connection()\\`)\\n https://nextjs.org/docs/messages/blocking-prerender-dynamic#cache-the-component-or-data\\n - [block] Set \\`export const instant = false\\` to allow a blocking route\\n https://nextjs.org/docs/messages/blocking-prerender-dynamic#allow-blocking-route",
1403+
"1402": "Route \"%s\": Next.js encountered runtime data during prerendering or a navigation.\\n\\n\\`cookies()\\`, \\`headers()\\`, \\`params\\`, or \\`searchParams\\` accessed outside of \\`<Suspense>\\` prevents the route from being prerendered or the navigation from being instant, leading to a slower user experience.\\n\\nWays to fix this:\\n - [stream] Provide a placeholder with \\`<Suspense fallback={...}>\\` around the data access\\n https://nextjs.org/docs/messages/blocking-prerender-runtime#wrap-in-or-move-into-suspense\\n - [block] Set \\`export const instant = false\\` to allow a blocking route\\n https://nextjs.org/docs/messages/blocking-prerender-runtime#allow-blocking-route",
1404+
"1403": "Route \"%s\": Next.js encountered link data during prerendering or a navigation.\\n\\n\\`params\\` or \\`searchParams\\` accessed outside of \\`<Suspense>\\` prevents the navigation from being instant, leading to a slower user experience.\\n\\nWays to fix this:\\n - [stream] Provide a placeholder with \\`<Suspense fallback={...}>\\` around the data access\\n https://nextjs.org/docs/messages/blocking-prerender-runtime#wrap-in-or-move-into-suspense\\n - [block] Set \\`export const instant = false\\` to allow a blocking route\\n https://nextjs.org/docs/messages/blocking-prerender-runtime#allow-blocking-route",
1405+
"1404": "Route \"%s\": Next.js encountered runtime data in \\`generateViewport()\\`.\\n\\n\\`cookies()\\`, \\`headers()\\`, \\`params\\`, or \\`searchParams\\` in \\`generateViewport()\\` prevents the page from being prerendered, leading to a slower user experience.\\n\\nWays to fix this:\\n - [static] Use a static viewport export instead of \\`generateViewport()\\`\\n https://nextjs.org/docs/messages/blocking-prerender-viewport-runtime#use-static-viewport\\n - [block] Set \\`export const instant = false\\` to allow a blocking route\\n https://nextjs.org/docs/messages/blocking-prerender-viewport-runtime#allow-blocking-route",
1406+
"1405": "Route \"%s\": Next.js encountered URL data \\`%s\\` in a Client Component outside of \\`<Suspense>\\`.\\n\\nThis blocks prerendering because the value is only available at runtime.\\n\\nWays to fix this:\\n - [stream] Wrap the component in \\`<Suspense fallback={...}>\\` so the hook value streams in after prerendering\\n https://nextjs.org/docs/messages/blocking-prerender-client-hook#wrap-in-or-move-into-suspense\\n - [block] Set \\`export const instant = false\\` to allow a blocking route\\n https://nextjs.org/docs/messages/blocking-prerender-client-hook#allow-blocking-route"
13951407
}

0 commit comments

Comments
 (0)