Skip to content

Commit

Permalink
Use hasConcurrentFeatures instead of reactRoot as the condition of Fi…
Browse files Browse the repository at this point in the history
…zz (#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`
  • Loading branch information
shuding committed Mar 17, 2022
1 parent d3a53a6 commit 62b4677
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/next/server/render.tsx
Expand Up @@ -449,7 +449,7 @@ export async function renderToHTML(
devOnlyCacheBusterQueryString,
supportsDynamicHTML,
images,
reactRoot,
// reactRoot,
runtime,
ComponentMod,
AppMod,
Expand Down Expand Up @@ -1216,7 +1216,7 @@ export async function renderToHTML(
return inAmpMode ? children : <div id="__next">{children}</div>
}

const ReactDOMServer = reactRoot
const ReactDOMServer = hasConcurrentFeatures
? require('react-dom/server.browser')
: require('react-dom/server')

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 62b4677

Please sign in to comment.