[Fizz] Reuse rootSegmentID as the SuspenseBoundaryID (#27387)

Originally the intension was to have React assign an ID to a user
rendered DOM node inside a `fallback` while it was loading. If there
already were an explicit `id` defined on the DOM element we would reuse
that one instead. That's why this was a DOM Config option and not just
built in to Fizz.

This became tricky since it can load late and so we'd have to transfer
it down and detect it only once it finished rendering and if there is no
DOM element it doesn't work anyway. So instead, what we do in practice
is to always use a `<template>` tag with the ID. This has the downside
of an extra useless node and shifting child CSS selectors.

Maybe we'll get around to fixing this properly but it might not be worth
it.

This PR just gets rid of the SuspenseBoundaryID concept and instead we
just use the same ID number as the root segment ID of the boundary to
refer to the boundary to simplify the implementation.

This also solves the problem that SuspenseBoundaryID isn't currently
serializable (although that's easily fixable by itself if necessary).

DiffTrain build for commit https://github.com/facebook/react/commit/2807d781a08db8e9873687fccc25c0f12b4fb3d4.
This commit is contained in:
sebmarkbage
2023-09-18 16:01:33 +00:00
parent 2c46007254
commit 95d14f5f28
7 changed files with 9 additions and 9 deletions
@@ -23998,7 +23998,7 @@ function createFiberRoot(
return root;
}
var ReactVersion = "18.3.0-canary-925c66a64-20230918";
var ReactVersion = "18.3.0-canary-2807d781a-20230918";
// Might add PROFILE later.
@@ -8620,7 +8620,7 @@ var devToolsConfig$jscomp$inline_1028 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-925c66a64-20230918",
version: "18.3.0-canary-2807d781a-20230918",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1227 = {
@@ -8651,7 +8651,7 @@ var internals$jscomp$inline_1227 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-925c66a64-20230918"
reconcilerVersion: "18.3.0-canary-2807d781a-20230918"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1228 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -9046,7 +9046,7 @@ var devToolsConfig$jscomp$inline_1070 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-925c66a64-20230918",
version: "18.3.0-canary-2807d781a-20230918",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1268 = {
@@ -9077,7 +9077,7 @@ var internals$jscomp$inline_1268 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-925c66a64-20230918"
reconcilerVersion: "18.3.0-canary-2807d781a-20230918"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1269 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -27,7 +27,7 @@ if (
}
"use strict";
var ReactVersion = "18.3.0-canary-925c66a64-20230918";
var ReactVersion = "18.3.0-canary-2807d781a-20230918";
// ATTENTION
// When adding new symbols to this file,
@@ -616,4 +616,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-925c66a64-20230918";
exports.version = "18.3.0-canary-2807d781a-20230918";
@@ -619,7 +619,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-925c66a64-20230918";
exports.version = "18.3.0-canary-2807d781a-20230918";
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
@@ -1 +1 @@
925c66a6472a61e7174dabf6c697a9a320ebc170
2807d781a08db8e9873687fccc25c0f12b4fb3d4