next.js
2550d800 - [dynamicIO] Fix false-positive dynamic viewport error

Commit
256 days ago
[dynamicIO] Fix false-positive dynamic viewport error When using sync IO like `new Date()` in a client component that has a parent Suspense boundary, we should not show a prerender validation error when `dynamicIO` is enabled. Due to how we render the head node in parallel to the segment node, and because the `Viewport` component that's included in the head is an async component, we incorrectly showed the following validation error, because the prerender was aborted before the async (and cached) viewport element resolved. > Route "/" has a `generateViewport` that depends on Request data > (`cookies()`, etc...) or uncached external data (`fetch(...)`, etc...) > without explicitly allowing fully dynamic rendering. See more info > here: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport We can fix this by deferring the rendering of the segment node until the scheduled microtasks have been executed. This ensures that the viewport task is not pending when the abort occurs.
Author
Parents
Loading