mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
## 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 -->
77 lines
2.7 KiB
TypeScript
77 lines
2.7 KiB
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
import { waitForNoErrorToast } from 'next-test-utils'
|
|
import { join } from 'node:path'
|
|
|
|
describe('instant validation - opting out of static shells', () => {
|
|
const { next, skipped, isNextDev } = nextTestSetup({
|
|
files: join(__dirname, 'fixtures', 'valid'),
|
|
skipDeployment: true,
|
|
})
|
|
if (skipped) return
|
|
|
|
// NOTE: if something's wrong in build, we'll fail before any tests run.
|
|
// Visiting the pages is mostly just a sanity check.
|
|
|
|
it('does not require a static shell if a root layouts is configured as blocking', async () => {
|
|
const browser = await next.browser('/blocking-root-layout')
|
|
await browser.elementByCss('main')
|
|
if (isNextDev) await waitForNoErrorToast(browser)
|
|
})
|
|
it('does not require a static shell if a layout is configured as blocking', async () => {
|
|
const browser = await next.browser('/blocking-layout')
|
|
await browser.elementByCss('main')
|
|
if (isNextDev) await waitForNoErrorToast(browser)
|
|
})
|
|
it('does not require a static shell if a page is configured as blocking', async () => {
|
|
const browser = await next.browser('/blocking-page')
|
|
await browser.elementByCss('main')
|
|
if (isNextDev) await waitForNoErrorToast(browser)
|
|
})
|
|
})
|
|
|
|
describe('instant validation', () => {
|
|
describe('requires a static shell if a below a static layout page is configured as blocking', () => {
|
|
const { next, skipped, isNextDev } = nextTestSetup({
|
|
files: join(__dirname, 'fixtures', 'invalid-blocking-page-below-static'),
|
|
skipStart: true,
|
|
skipDeployment: true,
|
|
})
|
|
if (skipped) return
|
|
|
|
if (isNextDev) {
|
|
beforeAll(() => next.start())
|
|
it('errors in dev', async () => {
|
|
const browser = await next.browser('/blocking-page-below-static')
|
|
await browser.elementByCss('main')
|
|
await expect(browser).toDisplayCollapsedRedbox(`
|
|
{
|
|
"code": "E1440",
|
|
"description": "Next.js encountered uncached data during prerendering.",
|
|
"environmentLabel": "Server",
|
|
"label": "Blocking Route",
|
|
"source": "app/blocking-page-below-static/page.tsx (6:19) @ Page
|
|
> 6 | await connection()
|
|
| ^",
|
|
"stack": [
|
|
"Page app/blocking-page-below-static/page.tsx (6:19)",
|
|
],
|
|
}
|
|
`)
|
|
})
|
|
} else {
|
|
let didBuildError = false
|
|
beforeAll(async () => {
|
|
try {
|
|
await next.start()
|
|
} catch (err) {
|
|
didBuildError = true
|
|
}
|
|
})
|
|
it('errors during build', () => {
|
|
expect(didBuildError).toBe(true)
|
|
expect(next.cliOutput).toContain('during prerendering')
|
|
})
|
|
}
|
|
})
|
|
})
|