Skip to content

Conversation

yimingjfe
Copy link
Member

@yimingjfe yimingjfe commented Aug 26, 2025

Summary

After upgrading to react19, you will see the streaming ssr project page, which will wait for the data to be obtained before returning. After investigation, I found the reason is that react returns the first chunk to Modern.js runtime too late.

In our original implementation, because the Await component throws a promise, the SSR root segment is marked as POSTPONED by React 19, causing the first chunk to respond late.

With the DeferredScript component, we can't prevent React 19 from marking the root segment as POSTPONED, so we write the scripts in createReadableStream.

Related Links

Checklist

  • I have added changeset via pnpm run change.
  • I have updated the documentation.
  • I have added tests to cover my changes.

Copy link

changeset-bot bot commented Aug 26, 2025

🦋 Changeset detected

Latest commit: e44c1cd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 152 packages
Name Type
@modern-js/runtime Patch
@modern-js/plugin-bff Patch
@modern-js/plugin-styled-components Patch
@modern-js/plugin-tailwindcss Patch
@integration-test/alias-set Patch
app-document Patch
async-entry-test Patch
tmp Patch
bff-api-app Patch
bff-client-app Patch
bff-indep-client-app Patch
bff-hono Patch
integration-clean-dist-path Patch
integration-compatibility Patch
integration-custom-dist-path Patch
custom-file-system-entry Patch
integration-custom-template Patch
deploy Patch
deploy-server Patch
dev-server Patch
integration-disable-html Patch
app-custom-routes-runtime Patch
app-custom Patch
app-entry Patch
app-route Patch
app-entry-server Patch
@integration-test/image-component Patch
main-entry-name Patch
nonce Patch
pure-esm-project Patch
routes-match Patch
routes Patch
app-rsbuild-hooks Patch
rsc-csr-app Patch
rsc-csr-routes Patch
rsc-ssr-app Patch
rsc-ssr-routes Patch
runtime-custom-plugin Patch
runtime-custom-config-plugin Patch
select-mul-entry-test Patch
select-one-entry-test Patch
server-config Patch
server-json-script Patch
server-monitors Patch
server-prod Patch
server-routes Patch
@source-code-build/app Patch
ssg-fixtures-mega-list-routes Patch
ssg-fixtures-nested-routes Patch
ssg-fixtures-simple Patch
ssg-fixtures-web-server Patch
ssr-base-async-entry-test Patch
ssr-base-json-test Patch
ssr-base-test Patch
ssr-base-fallback-test Patch
init Patch
ssr-base-loadable Patch
ssr-partial-test Patch
ssr-script-loading Patch
ssr-streaming-inline-test Patch
ssr-streaming-test Patch
styled-components-stream Patch
styled-components-string Patch
integration-tailwindcss-v2 Patch
integration-tailwindcss-v3-js-config-with-postcss-config Patch
integration-tailwindcss-v3-js-config Patch
integration-tailwindcss-v3-merge-config Patch
integration-tailwindcss-v3-ts-config Patch
integration-tailwindcss-v3 Patch
integration-tailwindcss-without-plugin Patch
twin-macro-v2 Patch
twin-macro-v3 Patch
tmp-dir Patch
transform-import-type-test Patch
write-to-dist Patch
@modern-js/tsconfig Patch
@modern-js/babel-preset Patch
@modern-js/builder Patch
@modern-js/flight-server-transform-plugin Patch
@modern-js/plugin-data-loader Patch
@modern-js/plugin-i18n Patch
@modern-js/plugin-ssg Patch
@modern-js/main-doc Patch
@modern-js/image Patch
@modern-js/render Patch
@modern-js/new-action Patch
@modern-js/sandpack-react Patch
@modern-js/babel-plugin-module-resolver Patch
@modern-js/bff-core Patch
@modern-js/bff-runtime Patch
@modern-js/server-core Patch
@modern-js/create-request Patch
@modern-js/plugin-polyfill Patch
@modern-js/plugin-worker Patch
@modern-js/prod-server Patch
@modern-js/server-runtime Patch
@modern-js/server Patch
@modern-js/server-utils Patch
@modern-js/app-tools Patch
@modern-js/create Patch
@modern-js/node-bundle-require Patch
@modern-js/plugin Patch
@modern-js/runtime-utils Patch
@modern-js/types Patch
@modern-js/upgrade Patch
@modern-js/utils Patch
@modern-js/babel-compiler Patch
@scripts/build Patch
@scripts/check-changeset Patch
@scripts/jest-config Patch
@scripts/lint-package-json Patch
@scripts/prebundle Patch
@scripts/release-node Patch
@scripts/release-versin Patch
@scripts/update-codesmith Patch
@scripts/vitest-config Patch
tests Patch
integration-asset-prefix Patch
integration-builder-plugins Patch
integration-copy-assets Patch
entries-app-builder Patch
entries-integration Patch
integration-config-async-config-test Patch
integration-basic-local-config Patch
integration-config-function-params Patch
integration-local-config-function Patch
integration-load-config Patch
entry Patch
@source-code-build/common Patch
@source-code-build/components Patch
@source-code-build/utils Patch
ssg Patch
ssr Patch
styled-components-test Patch
tailwindcss-integration-test Patch
@e2e/webpack-builder-test-moment Patch
@e2e/webpack-builder-source-map Patch
@e2e/builder Patch
@modern-js/generator-common Patch
@modern-js/generator-utils Patch
@modern-js/bff-generator Patch
@modern-js/dependence-generator Patch
@modern-js/entry-generator Patch
@modern-js/mwa-generator Patch
@modern-js/router-v5-generator Patch
@modern-js/ssg-generator Patch
@modern-js/upgrade-generator Patch
@modern-js/generator-cases Patch
@modern-js/base-generator Patch
@modern-js/packages-generator Patch
@modern-js/server-generator Patch
@modern-js/tailwindcss-generator Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@yimingjfe yimingjfe enabled auto-merge (squash) September 9, 2025 07:43
@yimingjfe yimingjfe merged commit 7bf5150 into web-infra-dev:main Sep 9, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants