From 62b46772a07ea7c4bd2017bec6a49622a6e0f181 Mon Sep 17 00:00:00 2001 From: Shu Ding Date: Thu, 17 Mar 2022 18:40:13 +0100 Subject: [PATCH] Use hasConcurrentFeatures instead of reactRoot as the condition of Fizz (#35407) We should use the `hasConcurrentFeatures` as the condition to enable Fizz, instead of reactRoot, otherwise just by installing React 18 will break stuff such as CSS imports. Currently `hasConcurrentFeatures` still needs to opt-in via the global `runtime` option. Once we fixed all the CSS bugs and add back #35245, we can flip the condition here again. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `yarn lint` --- packages/next/server/render.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/next/server/render.tsx b/packages/next/server/render.tsx index 7797d1d65404..e80cf62991cc 100644 --- a/packages/next/server/render.tsx +++ b/packages/next/server/render.tsx @@ -449,7 +449,7 @@ export async function renderToHTML( devOnlyCacheBusterQueryString, supportsDynamicHTML, images, - reactRoot, + // reactRoot, runtime, ComponentMod, AppMod, @@ -1216,7 +1216,7 @@ export async function renderToHTML( return inAmpMode ? children :
{children}
} - const ReactDOMServer = reactRoot + const ReactDOMServer = hasConcurrentFeatures ? require('react-dom/server.browser') : require('react-dom/server') @@ -1339,7 +1339,7 @@ export async function renderToHTML( ) } - if (reactRoot) { + if (hasConcurrentFeatures) { bodyResult = async (suffix: string) => { // this must be called inside bodyResult so appWrappers is // up to date when getWrappedApp is called