-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial support for Server Component style Document
s
#27794
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Document
componentsDocument
s
This comment has been minimized.
This comment has been minimized.
Document
sDocument
s
984fae5
to
029c648
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Implements `renderToString` in terms of a new `renderToStream`. The former is used for legacy documents that generate the body HTML as part of `getInitialProps`. The latter will be used directly in #27794 when streaming dynamic HTML. Since we're exposing an actual streaming response for dynamic HTML (instead of buffering with `resultFromChunks`), we use `multiplexResult` to buffer and multiplex the underlying result to multiple subscribers.
a181343
to
625022f
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Failing test suitesCommit: 8be28d4 test/integration/react-18/test/index.test.js
Expand output● Basics › default setting with react 18 (dev) › should render fallback without preloads on server side
● Basics › default setting with react 18 (prod) › should render fallback without preloads on server side
● Basics › suspense is not allowed in blocking rendering mode (dev)
● Blocking mode › concurrentFeatures is disabled (dev) › should render fallback on server side if suspense without preload
● Blocking mode › concurrentFeatures is disabled (dev) › should render fallback on server side if suspended on server with preload
● Blocking mode › concurrentFeatures is disabled (prod) › should render fallback on server side if suspense without preload
● Blocking mode › concurrentFeatures is disabled (prod) › should render fallback on server side if suspended on server with preload
|
d0a0cce
to
481fa90
Compare
Stats from current PRDefault Build (Decrease detected ✓)General Overall increase
|
vercel/next.js canary | azukaru/next.js x-modern-legacy-doc-support | Change | |
---|---|---|---|
buildDuration | 13.6s | 13.5s | -76ms |
buildDurationCached | 3.5s | 3.5s | -83ms |
nodeModulesSize | 49.7 MB | 49.7 MB |
Page Load Tests Overall decrease ⚠️
vercel/next.js canary | azukaru/next.js x-modern-legacy-doc-support | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.598 | 2.612 | |
/ avg req/sec | 962.32 | 957.24 | |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.423 | 1.503 | |
/error-in-render avg req/sec | 1756.44 | 1663.43 |
Client Bundles (main, webpack, commons)
vercel/next.js canary | azukaru/next.js x-modern-legacy-doc-support | Change | |
---|---|---|---|
745.HASH.js gzip | 179 B | 179 B | ✓ |
framework-HASH.js gzip | 42.2 kB | 42.2 kB | ✓ |
main-HASH.js gzip | 23.1 kB | 23.1 kB | ✓ |
webpack-HASH.js gzip | 1.44 kB | 1.44 kB | ✓ |
Overall change | 67 kB | 67 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | azukaru/next.js x-modern-legacy-doc-support | Change | |
---|---|---|---|
polyfills-a4..dd70.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | azukaru/next.js x-modern-legacy-doc-support | Change | |
---|---|---|---|
_app-HASH.js gzip | 980 B | 980 B | ✓ |
_error-HASH.js gzip | 194 B | 194 B | ✓ |
amp-HASH.js gzip | 312 B | 312 B | ✓ |
css-HASH.js gzip | 329 B | 329 B | ✓ |
dynamic-HASH.js gzip | 2.64 kB | 2.64 kB | ✓ |
head-HASH.js gzip | 350 B | 350 B | ✓ |
hooks-HASH.js gzip | 904 B | 904 B | ✓ |
image-HASH.js gzip | 4.13 kB | 4.13 kB | ✓ |
index-HASH.js gzip | 261 B | 261 B | ✓ |
link-HASH.js gzip | 1.66 kB | 1.66 kB | ✓ |
routerDirect..HASH.js gzip | 319 B | 319 B | ✓ |
script-HASH.js gzip | 387 B | 387 B | ✓ |
withRouter-HASH.js gzip | 320 B | 320 B | ✓ |
bb14e60e810b..30f.css gzip | 125 B | 125 B | ✓ |
Overall change | 12.9 kB | 12.9 kB | ✓ |
Client Build Manifests
vercel/next.js canary | azukaru/next.js x-modern-legacy-doc-support | Change | |
---|---|---|---|
_buildManifest.js gzip | 491 B | 491 B | ✓ |
Overall change | 491 B | 491 B | ✓ |
Rendered Page Sizes
vercel/next.js canary | azukaru/next.js x-modern-legacy-doc-support | Change | |
---|---|---|---|
index.html gzip | 540 B | 540 B | ✓ |
link.html gzip | 551 B | 551 B | ✓ |
withRouter.html gzip | 532 B | 532 B | ✓ |
Overall change | 1.62 kB | 1.62 kB | ✓ |
Webpack 4 Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | azukaru/next.js x-modern-legacy-doc-support | Change | |
---|---|---|---|
buildDuration | 11.2s | 10.9s | -304ms |
buildDurationCached | 4.6s | 4.5s | -142ms |
nodeModulesSize | 49.7 MB | 49.7 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | azukaru/next.js x-modern-legacy-doc-support | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.675 | 2.569 | -0.11 |
/ avg req/sec | 934.62 | 973.08 | +38.46 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.483 | 1.44 | -0.04 |
/error-in-render avg req/sec | 1685.54 | 1735.91 | +50.37 |
Client Bundles (main, webpack, commons)
vercel/next.js canary | azukaru/next.js x-modern-legacy-doc-support | Change | |
---|---|---|---|
16.HASH.js gzip | 186 B | 186 B | ✓ |
677f882d2ed8..HASH.js gzip | 14 kB | 14 kB | ✓ |
framework.HASH.js gzip | 41.9 kB | 41.9 kB | ✓ |
main-HASH.js gzip | 10.6 kB | 10.6 kB | ✓ |
webpack-HASH.js gzip | 1.19 kB | 1.19 kB | ✓ |
Overall change | 67.9 kB | 67.9 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | azukaru/next.js x-modern-legacy-doc-support | Change | |
---|---|---|---|
polyfills-a4..dd70.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | azukaru/next.js x-modern-legacy-doc-support | Change | |
---|---|---|---|
_app-HASH.js gzip | 965 B | 965 B | ✓ |
_error-HASH.js gzip | 3.71 kB | 3.71 kB | ✓ |
amp-HASH.js gzip | 552 B | 552 B | ✓ |
css-HASH.js gzip | 333 B | 333 B | ✓ |
dynamic-HASH.js gzip | 2.83 kB | 2.83 kB | ✓ |
head-HASH.js gzip | 2.97 kB | 2.97 kB | ✓ |
hooks-HASH.js gzip | 911 B | 911 B | ✓ |
index-HASH.js gzip | 231 B | 231 B | ✓ |
link-HASH.js gzip | 1.64 kB | 1.64 kB | ✓ |
routerDirect..HASH.js gzip | 298 B | 298 B | ✓ |
script-HASH.js gzip | 2.95 kB | 2.95 kB | ✓ |
withRouter-HASH.js gzip | 294 B | 294 B | ✓ |
e025d2764813..52f.css gzip | 125 B | 125 B | ✓ |
Overall change | 17.8 kB | 17.8 kB | ✓ |
Client Build Manifests
vercel/next.js canary | azukaru/next.js x-modern-legacy-doc-support | Change | |
---|---|---|---|
_buildManifest.js gzip | 498 B | 498 B | ✓ |
Overall change | 498 B | 498 B | ✓ |
Rendered Page Sizes
vercel/next.js canary | azukaru/next.js x-modern-legacy-doc-support | Change | |
---|---|---|---|
index.html gzip | 584 B | 584 B | ✓ |
link.html gzip | 596 B | 596 B | ✓ |
withRouter.html gzip | 578 B | 578 B | ✓ |
Overall change | 1.76 kB | 1.76 kB | ✓ |
Failing test suitesCommit: 481fa90 test/integration/react-18/test/index.test.js
Expand output● Basics › default setting with react 18 (dev) › should render fallback without preloads on server side
● Basics › default setting with react 18 (prod) › should render fallback without preloads on server side
● Basics › suspense is not allowed in blocking rendering mode (dev)
● Blocking mode › concurrentFeatures is disabled (dev) › should render fallback on server side if suspense without preload
● Blocking mode › concurrentFeatures is disabled (dev) › should render fallback on server side if suspended on server with preload
● Blocking mode › concurrentFeatures is disabled (prod) › should render fallback on server side if suspense without preload
● Blocking mode › concurrentFeatures is disabled (prod) › should render fallback on server side if suspended on server with preload
|
Stats from current PRDefault Build (Increase detected
|
vercel/next.js canary | azukaru/next.js x-modern-legacy-doc-support | Change | |
---|---|---|---|
buildDuration | 16.6s | 16.8s | |
buildDurationCached | 4.2s | 4.2s | -13ms |
nodeModulesSize | 49.7 MB | 49.7 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | azukaru/next.js x-modern-legacy-doc-support | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 3.395 | 3.268 | -0.13 |
/ avg req/sec | 736.47 | 765.09 | +28.62 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 2.005 | 2.012 | |
/error-in-render avg req/sec | 1246.81 | 1242.66 |
Client Bundles (main, webpack, commons)
vercel/next.js canary | azukaru/next.js x-modern-legacy-doc-support | Change | |
---|---|---|---|
745.HASH.js gzip | 179 B | 179 B | ✓ |
framework-HASH.js gzip | 42.2 kB | 42.2 kB | ✓ |
main-HASH.js gzip | 23.1 kB | 23.1 kB | ✓ |
webpack-HASH.js gzip | 1.44 kB | 1.44 kB | ✓ |
Overall change | 67 kB | 67 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | azukaru/next.js x-modern-legacy-doc-support | Change | |
---|---|---|---|
polyfills-a4..dd70.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | azukaru/next.js x-modern-legacy-doc-support | Change | |
---|---|---|---|
_app-HASH.js gzip | 980 B | 980 B | ✓ |
_error-HASH.js gzip | 194 B | 194 B | ✓ |
amp-HASH.js gzip | 312 B | 312 B | ✓ |
css-HASH.js gzip | 329 B | 329 B | ✓ |
dynamic-HASH.js gzip | 2.64 kB | 2.64 kB | ✓ |
head-HASH.js gzip | 350 B | 350 B | ✓ |
hooks-HASH.js gzip | 904 B | 904 B | ✓ |
image-HASH.js gzip | 4.13 kB | 4.13 kB | ✓ |
index-HASH.js gzip | 261 B | 261 B | ✓ |
link-HASH.js gzip | 1.66 kB | 1.66 kB | ✓ |
routerDirect..HASH.js gzip | 319 B | 319 B | ✓ |
script-HASH.js gzip | 387 B | 387 B | ✓ |
withRouter-HASH.js gzip | 320 B | 320 B | ✓ |
bb14e60e810b..30f.css gzip | 125 B | 125 B | ✓ |
Overall change | 12.9 kB | 12.9 kB | ✓ |
Client Build Manifests
vercel/next.js canary | azukaru/next.js x-modern-legacy-doc-support | Change | |
---|---|---|---|
_buildManifest.js gzip | 491 B | 491 B | ✓ |
Overall change | 491 B | 491 B | ✓ |
Rendered Page Sizes
vercel/next.js canary | azukaru/next.js x-modern-legacy-doc-support | Change | |
---|---|---|---|
index.html gzip | 540 B | 540 B | ✓ |
link.html gzip | 551 B | 551 B | ✓ |
withRouter.html gzip | 532 B | 532 B | ✓ |
Overall change | 1.62 kB | 1.62 kB | ✓ |
Webpack 4 Mode
General Overall increase ⚠️
vercel/next.js canary | azukaru/next.js x-modern-legacy-doc-support | Change | |
---|---|---|---|
buildDuration | 13.5s | 13.4s | -54ms |
buildDurationCached | 5.6s | 5.5s | -89ms |
nodeModulesSize | 49.7 MB | 49.7 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | azukaru/next.js x-modern-legacy-doc-support | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 3.397 | 3.359 | -0.04 |
/ avg req/sec | 735.86 | 744.32 | +8.46 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 2.085 | 2.097 | |
/error-in-render avg req/sec | 1199.09 | 1192.31 |
Client Bundles (main, webpack, commons)
vercel/next.js canary | azukaru/next.js x-modern-legacy-doc-support | Change | |
---|---|---|---|
16.HASH.js gzip | 186 B | 186 B | ✓ |
677f882d2ed8..HASH.js gzip | 14 kB | 14 kB | ✓ |
framework.HASH.js gzip | 41.9 kB | 41.9 kB | ✓ |
main-HASH.js gzip | 10.6 kB | 10.6 kB | ✓ |
webpack-HASH.js gzip | 1.19 kB | 1.19 kB | ✓ |
Overall change | 67.9 kB | 67.9 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | azukaru/next.js x-modern-legacy-doc-support | Change | |
---|---|---|---|
polyfills-a4..dd70.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | azukaru/next.js x-modern-legacy-doc-support | Change | |
---|---|---|---|
_app-HASH.js gzip | 965 B | 965 B | ✓ |
_error-HASH.js gzip | 3.71 kB | 3.71 kB | ✓ |
amp-HASH.js gzip | 552 B | 552 B | ✓ |
css-HASH.js gzip | 333 B | 333 B | ✓ |
dynamic-HASH.js gzip | 2.83 kB | 2.83 kB | ✓ |
head-HASH.js gzip | 2.97 kB | 2.97 kB | ✓ |
hooks-HASH.js gzip | 911 B | 911 B | ✓ |
index-HASH.js gzip | 231 B | 231 B | ✓ |
link-HASH.js gzip | 1.64 kB | 1.64 kB | ✓ |
routerDirect..HASH.js gzip | 298 B | 298 B | ✓ |
script-HASH.js gzip | 2.95 kB | 2.95 kB | ✓ |
withRouter-HASH.js gzip | 294 B | 294 B | ✓ |
e025d2764813..52f.css gzip | 125 B | 125 B | ✓ |
Overall change | 17.8 kB | 17.8 kB | ✓ |
Client Build Manifests
vercel/next.js canary | azukaru/next.js x-modern-legacy-doc-support | Change | |
---|---|---|---|
_buildManifest.js gzip | 498 B | 498 B | ✓ |
Overall change | 498 B | 498 B | ✓ |
Rendered Page Sizes
vercel/next.js canary | azukaru/next.js x-modern-legacy-doc-support | Change | |
---|---|---|---|
index.html gzip | 584 B | 584 B | ✓ |
link.html gzip | 596 B | 596 B | ✓ |
withRouter.html gzip | 578 B | 578 B | ✓ |
Overall change | 1.76 kB | 1.76 kB | ✓ |
Failing test suitesCommit: 4302ab4 test/integration/react-18/test/index.test.js
Expand output● Basics › default setting with react 18 (dev) › hydrates correctly for normal page
● Basics › default setting with react 18 (dev) › should works with suspense in ssg
● Basics › default setting with react 18 (dev) › should render fallback without preloads on server side
● Basics › default setting with react 18 (prod) › hydrates correctly for normal page
● Basics › default setting with react 18 (prod) › should works with suspense in ssg
● Basics › default setting with react 18 (prod) › should render fallback without preloads on server side
● Basics › suspense is not allowed in blocking rendering mode (dev)
● Blocking mode › concurrentFeatures is disabled (dev) › should render fallback on server side if suspense without preload
● Blocking mode › concurrentFeatures is disabled (dev) › should render fallback on server side if suspended on server with preload
● Blocking mode › concurrentFeatures is disabled (prod) › should render fallback on server side if suspense without preload
● Blocking mode › concurrentFeatures is disabled (prod) › should render fallback on server side if suspended on server with preload
● Concurrent mode › concurrentFeatures is enabled (dev) › should resolve suspense modules on server side if suspense
● Concurrent mode › concurrentFeatures is enabled (dev) › should resolve suspense on server side if not suspended on server
● Concurrent mode › concurrentFeatures is enabled (dev) › should resolve suspense on server side if suspended on server
● Concurrent mode › concurrentFeatures is enabled (dev) › should hydrate suspenses on client side if suspended on server
● Concurrent mode › concurrentFeatures is enabled (prod) › should resolve suspense modules on server side if suspense
● Concurrent mode › concurrentFeatures is enabled (prod) › should resolve suspense on server side if not suspended on server
● Concurrent mode › concurrentFeatures is enabled (prod) › should resolve suspense on server side if suspended on server
● Concurrent mode › concurrentFeatures is enabled (prod) › should hydrate suspenses on client side if suspended on server
● Test suite failed to run
● Test suite failed to run
● Test suite failed to run
|
Adds support for Server Component style
pages/_document
components, since this component only runs on the server.Server Components aren't stable yet, we just support a very minimal subset. You may only return HTML elements and elements from
next/document
. Hooks, suspense, context, etc are not currently supported. It's highly likely that anything more sophisticated than the following example will be broken by a future version of Next.js:Instead of
getInitialProps
, you should use suspense. The current iteration of this PR doesn't include that anymore, but support can be introduced if necessary.