Skip to content

Commit

Permalink
[Float][Fizz][Legacy] hoisted elements no longer emit before <html>
Browse files Browse the repository at this point in the history
… in legacy apis such as `renderToString()` (#27269)

renderToString is a legacy server API which used a trick to avoid having
the DOCTYPE included when rendering full documents by setting the root
formatcontext to HTML_MODE rather than ROOT_HTML_MODE. Previously this
was of little consequence but with Float the Root mode started to be
used for things like determining if we could flush hoistable elements
yet. In issue #27177 we see that hoisted elements can appear before the
<html> tag when using a legacy API `renderToString`.

This change exports a DOCTYPE from FizzConfigDOM and FizzConfigDOMLegacy
respectively, using an empty chunk in the legacy case. The only runtime
perf cost here is that for legacy APIs there is an extra empty chunk to
write when rendering a top level <html> tag which is trivial enough

Fixes #27177

DiffTrain build for commit 86198b9.
  • Loading branch information
gnoff committed Aug 22, 2023
1 parent 98164cb commit 19036c8
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23977,7 +23977,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-canary-dd480ef92-20230822";
var ReactVersion = "18.3.0-canary-86198b923-20230822";

// Might add PROFILE later.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8612,7 +8612,7 @@ var devToolsConfig$jscomp$inline_1029 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-dd480ef92-20230822",
version: "18.3.0-canary-86198b923-20230822",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1228 = {
Expand Down Expand Up @@ -8643,7 +8643,7 @@ var internals$jscomp$inline_1228 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-dd480ef92-20230822"
reconcilerVersion: "18.3.0-canary-86198b923-20230822"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1229 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9038,7 +9038,7 @@ var devToolsConfig$jscomp$inline_1071 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-dd480ef92-20230822",
version: "18.3.0-canary-86198b923-20230822",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1269 = {
Expand Down Expand Up @@ -9069,7 +9069,7 @@ var internals$jscomp$inline_1269 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-dd480ef92-20230822"
reconcilerVersion: "18.3.0-canary-86198b923-20230822"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1270 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-canary-dd480ef92-20230822";
var ReactVersion = "18.3.0-canary-86198b923-20230822";

// ATTENTION
// When adding new symbols to this file,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,4 +616,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-dd480ef92-20230822";
exports.version = "18.3.0-canary-86198b923-20230822";
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-dd480ef92-20230822";
exports.version = "18.3.0-canary-86198b923-20230822";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dd480ef923930c8906a02664b01bcdea50707b5d
86198b923199224b60533952b636348bb0484a6d

0 comments on commit 19036c8

Please sign in to comment.