Skip to content
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

[dynamicIO] complete refactor to prerender #71687

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions packages/next/src/server/app-render/app-render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3156,7 +3156,7 @@ async function prerenderToStream(

try {
htmlStream = await prerenderAndAbortInSequentialTasks(
() => {
async () => {
const teedStream = (
workUnitAsyncStorage.run(
// The store to scope
Expand All @@ -3176,11 +3176,11 @@ async function prerenderToStream(
reactServerStream = teedStream[0]
const rscForSSRStream = teedStream[1]

const renderToReadableStream = require('react-dom/server.edge')
.renderToReadableStream as (typeof import('react-dom/server.edge'))['renderToReadableStream']
const pendingHTMLStream = workUnitAsyncStorage.run(
const prerender = require('react-dom/static.edge')
.prerender as (typeof import('react-dom/static.edge'))['prerender']
const { prelude } = await workUnitAsyncStorage.run(
finalSSRPrerenderStore,
renderToReadableStream,
prerender,
<App
reactServerStream={rscForSSRStream}
preinitScripts={preinitScripts}
Expand All @@ -3198,8 +3198,7 @@ async function prerenderToStream(
: [bootstrapScript],
}
)
pendingHTMLStream.catch(() => {})
return pendingHTMLStream
return prelude
},
() => {
finalSSRController.abort(abortReason)
Expand Down
Loading