Unverified Commit 18d2e2da authored by Aurora Scharff's avatar Aurora Scharff Committed by GitHub

Insights: use a single Learn more link in console errors (#95967)

## Summary

The instant / blocking-prerender insight console errors printed a docs
URL under each fix option (two or three anchors per message). This
collapses them to a single `Learn more:` link at the end of each
message, while keeping the `[stream]`/`[cache]`/`[block]` fix-option
labels. It restores the single-link format these builders originally
shipped with.

**Before:**

```
Ways to fix this:
  - [stream] Provide a placeholder with `<Suspense fallback={...}>` around the data access
    https://nextjs.org/docs/messages/blocking-prerender-runtime#wrap-in-or-move-into-suspense
  - [block] Set `export const instant = false` to allow a blocking route
    https://nextjs.org/docs/messages/blocking-prerender-runtime#allow-blocking-route
```

**After:**

```
Ways to fix this:
  - [stream] Provide a placeholder with `<Suspense fallback={...}>` around the data access
  - [block] Set `export const instant = false` to allow a blocking route

Learn more: https://nextjs.org/docs/messages/blocking-prerender-runtime
```

Covers all 16 insight-kind errors, across `blocking-route-messages.ts`,
`sync-io-messages.ts`, `dynamic-rendering-utils.ts`, and
`instant-messages.ts`.

Because the dev overlay classified these errors by the `#`-anchored docs
URL, `getBlockingRouteErrorDetails` is updated to match the anchor-less
`Learn more:` URL. Console-message snapshots and the guidance-data
extraction test are updated to the new format. The dev-overlay fix-card
data (`instant-guidance-data.ts`) keeps its per-card links, since those
are the overlay UI rather than the console message.

## Verification

- `pnpm --filter=next types`
- Snapshots regenerated with `jest -u` for the affected suites

<!-- NEXT_JS_LLM -->
parent 380f0946
......@@ -112,11 +112,10 @@ Error: Route "/products/[id]": Next.js encountered uncached or runtime data duri
Ways to fix this:
- [stream] Provide a placeholder with `<Suspense fallback={...}>` around the data access
https://nextjs.org/docs/messages/blocking-prerender-dynamic#wrap-in-or-move-into-suspense
- [cache] For uncached data (`fetch`, database calls): cache the access with `"use cache"` (does not apply to `connection()`)
https://nextjs.org/docs/messages/blocking-prerender-dynamic#cache-the-component-or-data
- [block] Set `export const instant = false` to allow a blocking route
https://nextjs.org/docs/messages/blocking-prerender-dynamic#allow-blocking-route
Learn more: https://nextjs.org/docs/messages/blocking-prerender-dynamic
at body (<anonymous>)
at html (<anonymous>)
To get a more detailed stack trace and pinpoint the issue, try one of the following:
......
This diff is collapsed.
......@@ -115,80 +115,7 @@ describe('instant-guidance-data card ordering', () => {
)
})
function linksFromMessage(message: string): string[] {
return Array.from(message.matchAll(/^\s+(https:\/\/\S+)/gm)).map((m) => m[1])
}
describe('instant-guidance-data card links', () => {
it.each([
[
'blocking-route runtime',
createRuntimeBodyError('/x').message,
'blocking-route',
'runtime',
],
[
'blocking-route dynamic',
createDynamicBodyError('/x').message,
'blocking-route',
'dynamic',
],
[
'blocking-route link',
createLinkBodyErrorInNavigation('/x').message,
'blocking-route',
'link',
],
[
'metadata runtime',
createRuntimeMetadataError('/x').message,
'metadata',
'runtime',
],
[
'metadata dynamic',
createDynamicMetadataError('/x').message,
'metadata',
'dynamic',
],
[
'metadata link',
createLinkMetadataError('/x').message,
'metadata',
'link',
],
[
'viewport runtime',
createRuntimeViewportError('/x').message,
'viewport',
'runtime',
],
[
'viewport dynamic',
createDynamicViewportError('/x').message,
'viewport',
'dynamic',
],
[
'viewport link',
createLinkViewportError('/x').message,
'viewport',
'link',
],
[
'link-prefetch-partial',
createLinkPrefetchPartialError('/x').message,
'link-prefetch-partial',
'runtime',
],
] as const)(
'console URLs and overlay card links agree for %s',
(_name, message, kind, variant) => {
const cardLinks = getCards(kind, variant).map((card) => card.link)
expect(linksFromMessage(message)).toEqual(cardLinks)
}
)
it('every card.link ends with #card.id', () => {
const variants: Array<[GuidanceKind, GuidanceVariant]> = [
['blocking-route', 'runtime'],
......
......@@ -441,9 +441,9 @@ export function getBlockingRouteErrorDetails(
}
const isBlockingPageLoadError =
message.includes('/blocking-prerender-runtime#') ||
message.includes('/blocking-prerender-dynamic#') ||
message.includes('/instant-shell-url-data#')
message.includes('/blocking-prerender-runtime') ||
message.includes('/blocking-prerender-dynamic') ||
message.includes('/instant-shell-url-data')
if (isBlockingPageLoadError) {
return {
type: 'blocking-route',
......
......@@ -18,18 +18,12 @@ const SYNC_IO_RUNTIME_DOCS: Record<SyncIOApiType, string> = {
crypto: 'https://nextjs.org/docs/messages/blocking-prerender-crypto',
}
function elapsedTimeBullet(type: SyncIOApiType, docsUrl: string): string {
function elapsedTimeBullet(type: SyncIOApiType): string {
return type === 'time'
? `\n - [measure] If the value is for telemetry, use a timing API such as \`performance.now()\`\n ${docsUrl}#for-telemetry-use-a-timing-api`
? `\n - [measure] If the value is for telemetry, use a timing API such as \`performance.now()\``
: ''
}
const CACHE_ANCHOR: Record<SyncIOApiType, string> = {
random: '#cache-the-random-value',
time: '#cache-the-timestamp',
crypto: '#cache-the-generated-value',
}
function createSyncIOErrorImpl(
route: string,
expression: string,
......@@ -40,10 +34,11 @@ function createSyncIOErrorImpl(
`Route "${route}": Next.js encountered the unstable value ${expression} while prerendering.\n\n` +
`This value can change between renders, so it must be either prerendered or computed later.\n\n` +
`Ways to fix this:\n` +
` - [dynamic] Render at request time by adding a dynamic data access (e.g. \`await connection()\`) before this call\n ${docsUrl}#generate-on-every-request\n` +
` - [cache] Prerender and cache the value with \`"use cache"\`\n ${docsUrl}${CACHE_ANCHOR[type]}\n` +
` - [client] Render the value on the client with \`"use client"\`\n ${docsUrl}#render-on-the-client` +
elapsedTimeBullet(type, docsUrl)
` - [dynamic] Render at request time by adding a dynamic data access (e.g. \`await connection()\`) before this call\n` +
` - [cache] Prerender and cache the value with \`"use cache"\`\n` +
` - [client] Render the value on the client with \`"use client"\`` +
elapsedTimeBullet(type) +
`\n\nLearn more: ${docsUrl}`
)
}
......@@ -78,8 +73,9 @@ export function createSyncIOClientError(
`Route "${route}": Next.js encountered the unstable value ${expression} in a Client Component.\n\n` +
`This value would be evaluated during the prerender, instead of recomputed on each visit.\n\n` +
`Ways to fix this:\n` +
` - [stream] Wrap the Client Component in \`<Suspense fallback={...}>\`\n ${docsUrl}#wrap-in-or-move-into-suspense\n` +
` - [defer] Move the read into a \`useEffect\` or event handler\n ${docsUrl}#move-into-effect-or-event-handler` +
elapsedTimeBullet(type, docsUrl)
` - [stream] Wrap the Client Component in \`<Suspense fallback={...}>\`\n` +
` - [defer] Move the read into a \`useEffect\` or event handler` +
elapsedTimeBullet(type) +
`\n\nLearn more: ${docsUrl}`
)
}
......@@ -42,9 +42,8 @@ export class ClientHookDynamicError extends Error {
`This blocks prerendering because the value is only available at runtime.\n\n` +
`Ways 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`
` - [block] Set \`export const instant = false\` to allow a blocking route\n\n` +
`Learn more: https://nextjs.org/docs/messages/blocking-prerender-client-hook`
)
}
}
......
......@@ -11,9 +11,8 @@ export function createUnrenderedSegmentError(
`\n\n${label}:\n${missingFiles.map((p) => ` ${p}`).join('\n')}` +
`\n\nWays to fix this:` +
`\n - [render] Render the dropped segment` +
`\n https://nextjs.org/docs/messages/instant-unrendered-segment#render-the-dropped-segment` +
`\n - [ignore] Set \`export const instant = false\` to opt the dropped segment out of instant-navigation validation` +
`\n https://nextjs.org/docs/messages/instant-unrendered-segment#skip-validation-on-the-segment`
`\n\nLearn more: https://nextjs.org/docs/messages/instant-unrendered-segment`
}
return new Error(message)
}
......@@ -24,10 +23,8 @@ export function createLinkPrefetchPartialError(pathname: string): Error {
`This will lead to slower, more expensive prefetches.\n\n` +
`Ways 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`
` - [ignore] Set \`export const instant = false\` to opt the route out of instant-navigation validation\n\n` +
`Learn more: https://nextjs.org/docs/messages/instant-link-prefetch-partial`
)
}
......@@ -21,7 +21,7 @@ describe('Cache Components Dev Errors', () => {
// soft-navigating to the page (see test below).
await expect(browser).toDisplayCollapsedRedbox(`
{
"code": "E1295",
"code": "E1432",
"description": "Next.js encountered the unstable value Math.random() while prerendering.",
"environmentLabel": "Server",
"label": "Blocking Route",
......@@ -51,7 +51,7 @@ describe('Cache Components Dev Errors', () => {
// TODO: React should not include the anon stack in the Owner Stack.
await expect(browser).toDisplayCollapsedRedbox(`
{
"code": "E1295",
"code": "E1432",
"description": "Next.js encountered the unstable value Math.random() while prerendering.",
"environmentLabel": "Server",
"label": "Blocking Route",
......@@ -98,7 +98,7 @@ describe('Cache Components Dev Errors', () => {
await expect(browser).toDisplayCollapsedRedbox(`
{
"code": "E1401",
"code": "E1440",
"description": "Next.js encountered uncached data during prerendering.",
"environmentLabel": "Server",
"label": "Blocking Route",
......
......@@ -51,7 +51,7 @@ describe('Cache Components Fallback Validation', () => {
)
await expect(browser).toDisplayCollapsedRedbox(`
{
"code": "E1400",
"code": "E1427",
"description": "Next.js encountered runtime data during prerendering.",
"environmentLabel": "Server",
"label": "Blocking Route",
......@@ -67,7 +67,7 @@ describe('Cache Components Fallback Validation', () => {
await browser.loadPage(`${next.url}/partial/prerendered/unwrapped/novel`)
await expect(browser).toDisplayCollapsedRedbox(`
{
"code": "E1400",
"code": "E1427",
"description": "Next.js encountered runtime data during prerendering.",
"environmentLabel": "Server",
"label": "Blocking Route",
......@@ -83,7 +83,7 @@ describe('Cache Components Fallback Validation', () => {
await browser.loadPage(`${next.url}/partial/novel/unwrapped/novel`)
await expect(browser).toDisplayCollapsedRedbox(`
{
"code": "E1400",
"code": "E1427",
"description": "Next.js encountered runtime data during prerendering.",
"environmentLabel": "Server",
"label": "Blocking Route",
......@@ -103,7 +103,7 @@ describe('Cache Components Fallback Validation', () => {
const browser = await next.browser('/none/prerendered/wrapped/prerendered')
await expect(browser).toDisplayCollapsedRedbox(`
{
"code": "E1400",
"code": "E1427",
"description": "Next.js encountered runtime data during prerendering.",
"environmentLabel": "Server",
"label": "Blocking Route",
......@@ -119,7 +119,7 @@ describe('Cache Components Fallback Validation', () => {
await browser.loadPage(`${next.url}/none/prerendered/wrapped/novel`)
await expect(browser).toDisplayCollapsedRedbox(`
{
"code": "E1400",
"code": "E1427",
"description": "Next.js encountered runtime data during prerendering.",
"environmentLabel": "Server",
"label": "Blocking Route",
......@@ -135,7 +135,7 @@ describe('Cache Components Fallback Validation', () => {
await browser.loadPage(`${next.url}/none/novel/wrapped/novel`)
await expect(browser).toDisplayCollapsedRedbox(`
{
"code": "E1400",
"code": "E1427",
"description": "Next.js encountered runtime data during prerendering.",
"environmentLabel": "Server",
"label": "Blocking Route",
......@@ -151,7 +151,7 @@ describe('Cache Components Fallback Validation', () => {
await browser.loadPage(`${next.url}/none/prerendered/unwrapped/prerendered`)
await expect(browser).toDisplayCollapsedRedbox(`
{
"code": "E1400",
"code": "E1427",
"description": "Next.js encountered runtime data during prerendering.",
"environmentLabel": "Server",
"label": "Blocking Route",
......@@ -167,7 +167,7 @@ describe('Cache Components Fallback Validation', () => {
await browser.loadPage(`${next.url}/none/prerendered/unwrapped/novel`)
await expect(browser).toDisplayCollapsedRedbox(`
{
"code": "E1400",
"code": "E1427",
"description": "Next.js encountered runtime data during prerendering.",
"environmentLabel": "Server",
"label": "Blocking Route",
......@@ -183,7 +183,7 @@ describe('Cache Components Fallback Validation', () => {
await browser.loadPage(`${next.url}/none/novel/unwrapped/novel`)
await expect(browser).toDisplayCollapsedRedbox(`
{
"code": "E1400",
"code": "E1427",
"description": "Next.js encountered runtime data during prerendering.",
"environmentLabel": "Server",
"label": "Blocking Route",
......
......@@ -282,7 +282,7 @@ describe('cache-components-dev-streaming', () => {
// Cold cache miss: validation runs against a separate warm-cache render.
await expect(browser).toDisplayCollapsedRedbox(`
{
"code": "E1401",
"code": "E1440",
"description": "Next.js encountered uncached data during prerendering.",
"environmentLabel": "Server",
"label": "Blocking Route",
......@@ -307,7 +307,7 @@ describe('cache-components-dev-streaming', () => {
// and the cached value is re-served rather than recomputed.
await expect(browser).toDisplayCollapsedRedbox(`
{
"code": "E1401",
"code": "E1440",
"description": "Next.js encountered uncached data during prerendering.",
"environmentLabel": "Server",
"label": "Blocking Route",
......@@ -329,7 +329,7 @@ describe('cache-components-dev-streaming', () => {
// Cold cache miss: validation runs against a separate warm-cache render.
await expect(browser).toDisplayCollapsedRedbox(`
{
"code": "E1295",
"code": "E1432",
"description": "Next.js encountered the unstable value Date() while prerendering.",
"environmentLabel": "Server",
"label": "Blocking Route",
......@@ -354,7 +354,7 @@ describe('cache-components-dev-streaming', () => {
// and the cached value is re-served rather than recomputed.
await expect(browser).toDisplayCollapsedRedbox(`
{
"code": "E1295",
"code": "E1432",
"description": "Next.js encountered the unstable value Date() while prerendering.",
"environmentLabel": "Server",
"label": "Blocking Route",
......
......@@ -34,7 +34,7 @@ describe('prefetch-true-partial-warning', () => {
await expect(browser).toDisplayCollapsedRedbox(`
{
"code": "E1394",
"code": "E1435",
"description": "Next.js encountered dynamic data during prefetching.",
"environmentLabel": null,
"label": "Instant",
......
......@@ -70,11 +70,10 @@ describe('instant-validation-build', () => {
Ways to fix this:
- [stream] Provide a placeholder with \`<Suspense fallback={...}>\` around the data access
https://nextjs.org/docs/messages/blocking-prerender-dynamic#wrap-in-or-move-into-suspense
- [cache] Cache the data access with \`"use cache"\` (does not apply to \`connection()\`)
https://nextjs.org/docs/messages/blocking-prerender-dynamic#cache-the-component-or-data
- [block] Set \`export const instant = false\` to allow a blocking route
https://nextjs.org/docs/messages/blocking-prerender-dynamic#allow-blocking-route
Learn more: https://nextjs.org/docs/messages/blocking-prerender-dynamic
at main (<anonymous>)
at body (<anonymous>)
at html (<anonymous>)
......
......@@ -105,7 +105,7 @@ describe('instant validation causes', () => {
],
},
],
"code": "E1398",
"code": "E1437",
"description": "Next.js encountered uncached data during a navigation.",
"environmentLabel": "Server",
"label": "Instant",
......@@ -136,7 +136,7 @@ describe('instant validation causes', () => {
],
},
],
"code": "E1398",
"code": "E1437",
"description": "Next.js encountered uncached data during a navigation.",
"environmentLabel": "Server",
"label": "Instant",
......@@ -167,7 +167,7 @@ describe('instant validation causes', () => {
],
},
],
"code": "E1398",
"code": "E1437",
"description": "Next.js encountered uncached data during a navigation.",
"environmentLabel": "Server",
"label": "Instant",
......@@ -201,7 +201,7 @@ describe('instant validation causes', () => {
],
},
],
"code": "E1398",
"code": "E1437",
"description": "Next.js encountered uncached data during a navigation.",
"environmentLabel": "Server",
"label": "Instant",
......
......@@ -57,7 +57,7 @@ describe('instant validation - default level', () => {
const browser = await next.browser('/bare')
await expect(browser).toDisplayCollapsedRedbox(`
{
"code": "E1398",
"code": "E1437",
"description": "Next.js encountered uncached data during a navigation.",
"environmentLabel": "Server",
"label": "Instant",
......
......@@ -60,7 +60,7 @@ describe('instant validation - level error', () => {
const browser = await next.browser('/bare')
await expect(browser).toDisplayCollapsedRedbox(`
{
"code": "E1398",
"code": "E1437",
"description": "Next.js encountered uncached data during a navigation.",
"environmentLabel": "Server",
"label": "Instant",
......@@ -90,7 +90,7 @@ describe('instant validation - level error', () => {
],
},
],
"code": "E1398",
"code": "E1437",
"description": "Next.js encountered uncached data during a navigation.",
"environmentLabel": "Server",
"label": "Instant",
......@@ -120,7 +120,7 @@ describe('instant validation - level error', () => {
],
},
],
"code": "E1398",
"code": "E1437",
"description": "Next.js encountered uncached data during a navigation.",
"environmentLabel": "Server",
"label": "Instant",
......@@ -150,7 +150,7 @@ describe('instant validation - level error', () => {
],
},
],
"code": "E1398",
"code": "E1437",
"description": "Next.js encountered uncached data during a navigation.",
"environmentLabel": "Server",
"label": "Instant",
......@@ -177,7 +177,7 @@ describe('instant validation - level error', () => {
const browser = await next.browser('/layered')
await expect(browser).toDisplayCollapsedRedbox(`
{
"code": "E1398",
"code": "E1437",
"description": "Next.js encountered uncached data during a navigation.",
"environmentLabel": "Server",
"label": "Instant",
......@@ -203,11 +203,10 @@ describe('instant validation - level error', () => {
Ways to fix this:
- [stream] Provide a placeholder with \`<Suspense fallback={...}>\` around the data access
https://nextjs.org/docs/messages/blocking-prerender-dynamic#wrap-in-or-move-into-suspense
- [cache] Cache the data access with \`"use cache"\` (does not apply to \`connection()\`)
https://nextjs.org/docs/messages/blocking-prerender-dynamic#cache-the-component-or-data
- [block] Set \`export const instant = false\` to allow a blocking route
https://nextjs.org/docs/messages/blocking-prerender-dynamic#allow-blocking-route
Learn more: https://nextjs.org/docs/messages/blocking-prerender-dynamic
at a (<anonymous>)
at body (<anonymous>)
at html (<anonymous>)
......@@ -230,11 +229,10 @@ describe('instant validation - level error', () => {
Ways to fix this:
- [stream] Provide a placeholder with \`<Suspense fallback={...}>\` around the data access
https://nextjs.org/docs/messages/blocking-prerender-dynamic#wrap-in-or-move-into-suspense
- [cache] Cache the data access with \`"use cache"\` (does not apply to \`connection()\`)
https://nextjs.org/docs/messages/blocking-prerender-dynamic#cache-the-component-or-data
- [block] Set \`export const instant = false\` to allow a blocking route
https://nextjs.org/docs/messages/blocking-prerender-dynamic#allow-blocking-route
Learn more: https://nextjs.org/docs/messages/blocking-prerender-dynamic
at a (<anonymous>)
at body (<anonymous>)
at html (<anonymous>)
......@@ -257,11 +255,10 @@ describe('instant validation - level error', () => {
Ways to fix this:
- [stream] Provide a placeholder with \`<Suspense fallback={...}>\` around the data access
https://nextjs.org/docs/messages/blocking-prerender-dynamic#wrap-in-or-move-into-suspense
- [cache] Cache the data access with \`"use cache"\` (does not apply to \`connection()\`)
https://nextjs.org/docs/messages/blocking-prerender-dynamic#cache-the-component-or-data
- [block] Set \`export const instant = false\` to allow a blocking route
https://nextjs.org/docs/messages/blocking-prerender-dynamic#allow-blocking-route
Learn more: https://nextjs.org/docs/messages/blocking-prerender-dynamic
at a (<anonymous>)
at body (<anonymous>)
at html (<anonymous>)
......@@ -297,11 +294,10 @@ describe('instant validation - level error', () => {
Ways to fix this:
- [stream] Provide a placeholder with \`<Suspense fallback={...}>\` around the data access
https://nextjs.org/docs/messages/blocking-prerender-dynamic#wrap-in-or-move-into-suspense
- [cache] Cache the data access with \`"use cache"\` (does not apply to \`connection()\`)
https://nextjs.org/docs/messages/blocking-prerender-dynamic#cache-the-component-or-data
- [block] Set \`export const instant = false\` to allow a blocking route
https://nextjs.org/docs/messages/blocking-prerender-dynamic#allow-blocking-route
Learn more: https://nextjs.org/docs/messages/blocking-prerender-dynamic
at a (<anonymous>)
at body (<anonymous>)
at html (<anonymous>)
......
......@@ -79,7 +79,7 @@ describe('instant validation - level manual-error', () => {
],
},
],
"code": "E1398",
"code": "E1437",
"description": "Next.js encountered uncached data during a navigation.",
"environmentLabel": "Server",
"label": "Instant",
......@@ -109,7 +109,7 @@ describe('instant validation - level manual-error', () => {
],
},
],
"code": "E1398",
"code": "E1437",
"description": "Next.js encountered uncached data during a navigation.",
"environmentLabel": "Server",
"label": "Instant",
......@@ -139,7 +139,7 @@ describe('instant validation - level manual-error', () => {
],
},
],
"code": "E1398",
"code": "E1437",
"description": "Next.js encountered uncached data during a navigation.",
"environmentLabel": "Server",
"label": "Instant",
......@@ -186,11 +186,10 @@ describe('instant validation - level manual-error', () => {
Ways to fix this:
- [stream] Provide a placeholder with \`<Suspense fallback={...}>\` around the data access
https://nextjs.org/docs/messages/blocking-prerender-dynamic#wrap-in-or-move-into-suspense
- [cache] Cache the data access with \`"use cache"\` (does not apply to \`connection()\`)
https://nextjs.org/docs/messages/blocking-prerender-dynamic#cache-the-component-or-data
- [block] Set \`export const instant = false\` to allow a blocking route
https://nextjs.org/docs/messages/blocking-prerender-dynamic#allow-blocking-route
Learn more: https://nextjs.org/docs/messages/blocking-prerender-dynamic
at a (<anonymous>)
at body (<anonymous>)
at html (<anonymous>)
......@@ -213,11 +212,10 @@ describe('instant validation - level manual-error', () => {
Ways to fix this:
- [stream] Provide a placeholder with \`<Suspense fallback={...}>\` around the data access
https://nextjs.org/docs/messages/blocking-prerender-dynamic#wrap-in-or-move-into-suspense
- [cache] Cache the data access with \`"use cache"\` (does not apply to \`connection()\`)
https://nextjs.org/docs/messages/blocking-prerender-dynamic#cache-the-component-or-data
- [block] Set \`export const instant = false\` to allow a blocking route
https://nextjs.org/docs/messages/blocking-prerender-dynamic#allow-blocking-route
Learn more: https://nextjs.org/docs/messages/blocking-prerender-dynamic
at a (<anonymous>)
at body (<anonymous>)
at html (<anonymous>)
......
......@@ -93,7 +93,7 @@ describe('instant validation - level manual-warning', () => {
],
},
],
"code": "E1398",
"code": "E1437",
"description": "Next.js encountered uncached data during a navigation.",
"environmentLabel": "Server",
"label": "Instant",
......@@ -125,7 +125,7 @@ describe('instant validation - level manual-warning', () => {
],
},
],
"code": "E1398",
"code": "E1437",
"description": "Next.js encountered uncached data during a navigation.",
"environmentLabel": "Server",
"label": "Instant",
......@@ -157,7 +157,7 @@ describe('instant validation - level manual-warning', () => {
],
},
],
"code": "E1398",
"code": "E1437",
"description": "Next.js encountered uncached data during a navigation.",
"environmentLabel": "Server",
"label": "Instant",
......@@ -198,11 +198,10 @@ describe('instant validation - level manual-warning', () => {
Ways to fix this:
- [stream] Provide a placeholder with \`<Suspense fallback={...}>\` around the data access
https://nextjs.org/docs/messages/blocking-prerender-dynamic#wrap-in-or-move-into-suspense
- [cache] Cache the data access with \`"use cache"\` (does not apply to \`connection()\`)
https://nextjs.org/docs/messages/blocking-prerender-dynamic#cache-the-component-or-data
- [block] Set \`export const instant = false\` to allow a blocking route
https://nextjs.org/docs/messages/blocking-prerender-dynamic#allow-blocking-route
Learn more: https://nextjs.org/docs/messages/blocking-prerender-dynamic
at a (<anonymous>)
at body (<anonymous>)
at html (<anonymous>)
......@@ -230,7 +229,7 @@ describe('instant validation - level manual-warning', () => {
// did not run under 'manual-warning'.
await expect(browser).toDisplayCollapsedRedbox(`
{
"code": "E1401",
"code": "E1440",
"description": "Next.js encountered uncached data during prerendering.",
"environmentLabel": "Server",
"label": "Blocking Route",
......@@ -250,7 +249,7 @@ describe('instant validation - level manual-warning', () => {
)
await expect(browser).toDisplayCollapsedRedbox(`
{
"code": "E1401",
"code": "E1440",
"description": "Next.js encountered uncached data during prerendering.",
"environmentLabel": "Server",
"label": "Blocking Route",
......@@ -270,7 +269,7 @@ describe('instant validation - level manual-warning', () => {
)
await expect(browser).toDisplayCollapsedRedbox(`
{
"code": "E1401",
"code": "E1440",
"description": "Next.js encountered uncached data during prerendering.",
"environmentLabel": "Server",
"label": "Blocking Route",
......@@ -290,7 +289,7 @@ describe('instant validation - level manual-warning', () => {
)
await expect(browser).toDisplayCollapsedRedbox(`
{
"code": "E1401",
"code": "E1440",
"description": "Next.js encountered uncached data during prerendering.",
"environmentLabel": "Server",
"label": "Blocking Route",
......@@ -337,11 +336,10 @@ describe('instant validation - level manual-warning', () => {
Ways to fix this:
- [stream] Provide a placeholder with \`<Suspense fallback={...}>\` around the data access
https://nextjs.org/docs/messages/blocking-prerender-dynamic#wrap-in-or-move-into-suspense
- [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)
https://nextjs.org/docs/messages/blocking-prerender-dynamic#cache-the-component-or-data
- [block] Set \`export const instant = false\` to allow a blocking route
https://nextjs.org/docs/messages/blocking-prerender-dynamic#allow-blocking-route
Learn more: https://nextjs.org/docs/messages/blocking-prerender-dynamic
at body (<anonymous>)
at html (<anonymous>)
To get a more detailed stack trace and pinpoint the issue, try one of the following:
......@@ -363,11 +361,10 @@ describe('instant validation - level manual-warning', () => {
Ways to fix this:
- [stream] Provide a placeholder with \`<Suspense fallback={...}>\` around the data access
https://nextjs.org/docs/messages/blocking-prerender-dynamic#wrap-in-or-move-into-suspense
- [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)
https://nextjs.org/docs/messages/blocking-prerender-dynamic#cache-the-component-or-data
- [block] Set \`export const instant = false\` to allow a blocking route
https://nextjs.org/docs/messages/blocking-prerender-dynamic#allow-blocking-route
Learn more: https://nextjs.org/docs/messages/blocking-prerender-dynamic
at body (<anonymous>)
at html (<anonymous>)
To get a more detailed stack trace and pinpoint the issue, try one of the following:
......@@ -391,11 +388,10 @@ describe('instant validation - level manual-warning', () => {
Ways to fix this:
- [stream] Provide a placeholder with \`<Suspense fallback={...}>\` around the data access
https://nextjs.org/docs/messages/blocking-prerender-dynamic#wrap-in-or-move-into-suspense
- [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)
https://nextjs.org/docs/messages/blocking-prerender-dynamic#cache-the-component-or-data
- [block] Set \`export const instant = false\` to allow a blocking route
https://nextjs.org/docs/messages/blocking-prerender-dynamic#allow-blocking-route
Learn more: https://nextjs.org/docs/messages/blocking-prerender-dynamic
at body (<anonymous>)
at html (<anonymous>)
To get a more detailed stack trace and pinpoint the issue, try one of the following:
......@@ -423,11 +419,10 @@ describe('instant validation - level manual-warning', () => {
Ways to fix this:
- [stream] Provide a placeholder with \`<Suspense fallback={...}>\` around the data access
https://nextjs.org/docs/messages/blocking-prerender-dynamic#wrap-in-or-move-into-suspense
- [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)
https://nextjs.org/docs/messages/blocking-prerender-dynamic#cache-the-component-or-data
- [block] Set \`export const instant = false\` to allow a blocking route
https://nextjs.org/docs/messages/blocking-prerender-dynamic#allow-blocking-route
Learn more: https://nextjs.org/docs/messages/blocking-prerender-dynamic
at body (<anonymous>)
at html (<anonymous>)
To get a more detailed stack trace and pinpoint the issue, try one of the following:
......
......@@ -60,7 +60,7 @@ describe('instant validation - level warning', () => {
const browser = await next.browser('/bare')
await expect(browser).toDisplayCollapsedRedbox(`
{
"code": "E1398",
"code": "E1437",
"description": "Next.js encountered uncached data during a navigation.",
"environmentLabel": "Server",
"label": "Instant",
......@@ -90,7 +90,7 @@ describe('instant validation - level warning', () => {
],
},
],
"code": "E1398",
"code": "E1437",
"description": "Next.js encountered uncached data during a navigation.",
"environmentLabel": "Server",
"label": "Instant",
......@@ -120,7 +120,7 @@ describe('instant validation - level warning', () => {
],
},
],
"code": "E1398",
"code": "E1437",
"description": "Next.js encountered uncached data during a navigation.",
"environmentLabel": "Server",
"label": "Instant",
......@@ -150,7 +150,7 @@ describe('instant validation - level warning', () => {
],
},
],
"code": "E1398",
"code": "E1437",
"description": "Next.js encountered uncached data during a navigation.",
"environmentLabel": "Server",
"label": "Instant",
......@@ -177,7 +177,7 @@ describe('instant validation - level warning', () => {
const browser = await next.browser('/layered')
await expect(browser).toDisplayCollapsedRedbox(`
{
"code": "E1398",
"code": "E1437",
"description": "Next.js encountered uncached data during a navigation.",
"environmentLabel": "Server",
"label": "Instant",
......@@ -208,11 +208,10 @@ describe('instant validation - level warning', () => {
Ways to fix this:
- [stream] Provide a placeholder with \`<Suspense fallback={...}>\` around the data access
https://nextjs.org/docs/messages/blocking-prerender-dynamic#wrap-in-or-move-into-suspense
- [cache] Cache the data access with \`"use cache"\` (does not apply to \`connection()\`)
https://nextjs.org/docs/messages/blocking-prerender-dynamic#cache-the-component-or-data
- [block] Set \`export const instant = false\` to allow a blocking route
https://nextjs.org/docs/messages/blocking-prerender-dynamic#allow-blocking-route
Learn more: https://nextjs.org/docs/messages/blocking-prerender-dynamic
at a (<anonymous>)
at body (<anonymous>)
at html (<anonymous>)
......
......@@ -45,7 +45,7 @@ describe('instant validation', () => {
await browser.elementByCss('main')
await expect(browser).toDisplayCollapsedRedbox(`
{
"code": "E1401",
"code": "E1440",
"description": "Next.js encountered uncached data during prerendering.",
"environmentLabel": "Server",
"label": "Blocking Route",
......
......@@ -26,7 +26,7 @@ describe('missing-suspense-with-csr-bailout', () => {
describe('useSearchParams', () => {
const message = isCacheComponentsEnabled
? 'https://nextjs.org/docs/messages/blocking-prerender-client-hook#wrap-in-or-move-into-suspense'
? 'https://nextjs.org/docs/messages/blocking-prerender-client-hook'
: `useSearchParams() should be wrapped in a suspense boundary at page "/".`
it('should fail build if useSearchParams is not wrapped in a suspense boundary', async () => {
......
......@@ -89,11 +89,10 @@ describe('build-output-prerender', () => {
Ways to fix this:
- [stream] Wrap the Client Component in \`<Suspense fallback={...}>\`
https://nextjs.org/docs/messages/blocking-prerender-current-time-client#wrap-in-or-move-into-suspense
- [defer] Move the read into a \`useEffect\` or event handler
https://nextjs.org/docs/messages/blocking-prerender-current-time-client#move-into-effect-or-event-handler
- [measure] If the value is for telemetry, use a timing API such as \`performance.now()\`
https://nextjs.org/docs/messages/blocking-prerender-current-time-client#for-telemetry-use-a-timing-api
Learn more: https://nextjs.org/docs/messages/blocking-prerender-current-time-client
at <unknown> (app/client/page.tsx:4:28)
2 |
3 | export default function Page() {
......@@ -115,11 +114,10 @@ describe('build-output-prerender', () => {
Ways to fix this:
- [stream] Wrap the Client Component in \`<Suspense fallback={...}>\`
https://nextjs.org/docs/messages/blocking-prerender-current-time-client#wrap-in-or-move-into-suspense
- [defer] Move the read into a \`useEffect\` or event handler
https://nextjs.org/docs/messages/blocking-prerender-current-time-client#move-into-effect-or-event-handler
- [measure] If the value is for telemetry, use a timing API such as \`performance.now()\`
https://nextjs.org/docs/messages/blocking-prerender-current-time-client#for-telemetry-use-a-timing-api
Learn more: https://nextjs.org/docs/messages/blocking-prerender-current-time-client
at x (<next-dist-dir>)
To get a more detailed stack trace and pinpoint the issue, try one of the following:
- Start the app in development mode by running \`next dev\`, then open "/client" in your browser to investigate the error.
......@@ -244,11 +242,10 @@ describe('build-output-prerender', () => {
Ways to fix this:
- [stream] Wrap the Client Component in \`<Suspense fallback={...}>\`
https://nextjs.org/docs/messages/blocking-prerender-current-time-client#wrap-in-or-move-into-suspense
- [defer] Move the read into a \`useEffect\` or event handler
https://nextjs.org/docs/messages/blocking-prerender-current-time-client#move-into-effect-or-event-handler
- [measure] If the value is for telemetry, use a timing API such as \`performance.now()\`
https://nextjs.org/docs/messages/blocking-prerender-current-time-client#for-telemetry-use-a-timing-api
Learn more: https://nextjs.org/docs/messages/blocking-prerender-current-time-client
at Page (app/client/page.tsx:4:28)
2 |
3 | export default function Page() {
......@@ -264,11 +261,10 @@ describe('build-output-prerender', () => {
Ways to fix this:
- [dynamic] Render at request time by adding a dynamic data access (e.g. \`await connection()\`) before this call
https://nextjs.org/docs/messages/blocking-prerender-random#generate-on-every-request
- [cache] Prerender and cache the value with \`"use cache"\`
https://nextjs.org/docs/messages/blocking-prerender-random#cache-the-random-value
- [client] Render the value on the client with \`"use client"\`
https://nextjs.org/docs/messages/blocking-prerender-random#render-on-the-client
Learn more: https://nextjs.org/docs/messages/blocking-prerender-random
at Page (app/server/page.tsx:13:27)
at Page (<anonymous>)
11 | await cachedDelay()
......@@ -293,11 +289,10 @@ describe('build-output-prerender', () => {
Ways to fix this:
- [stream] Wrap the Client Component in \`<Suspense fallback={...}>\`
https://nextjs.org/docs/messages/blocking-prerender-current-time-client#wrap-in-or-move-into-suspense
- [defer] Move the read into a \`useEffect\` or event handler
https://nextjs.org/docs/messages/blocking-prerender-current-time-client#move-into-effect-or-event-handler
- [measure] If the value is for telemetry, use a timing API such as \`performance.now()\`
https://nextjs.org/docs/messages/blocking-prerender-current-time-client#for-telemetry-use-a-timing-api
Learn more: https://nextjs.org/docs/messages/blocking-prerender-current-time-client
at Page (webpack:///app/client/page.tsx:4:28)
at ClientPageRoot (webpack:///src/client/components/client-page.tsx:56:10)
2 |
......@@ -314,11 +309,10 @@ describe('build-output-prerender', () => {
Ways to fix this:
- [dynamic] Render at request time by adding a dynamic data access (e.g. \`await connection()\`) before this call
https://nextjs.org/docs/messages/blocking-prerender-random#generate-on-every-request
- [cache] Prerender and cache the value with \`"use cache"\`
https://nextjs.org/docs/messages/blocking-prerender-random#cache-the-random-value
- [client] Render the value on the client with \`"use client"\`
https://nextjs.org/docs/messages/blocking-prerender-random#render-on-the-client
Learn more: https://nextjs.org/docs/messages/blocking-prerender-random
at Page (webpack:///app/server/page.tsx:13:27)
at Page (<anonymous>)
11 | await cachedDelay()
......
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