Use concurrent root in RTR (#28498)

Based on
- https://github.com/facebook/react/pull/28497
- https://github.com/facebook/react/pull/28419

Reusing the disableLegacyMode flag, we set ReactTestRenderer to always
render with concurrent root where legacy APIs are no longer available.
If disableLegacyMode is false, we continue to allow the
unstable_isConcurrent option determine the root type.

Also checking a global `IS_REACT_NATIVE_TEST_ENVIRONMENT` so we can
maintain the existing behavior for RN until we remove legacy root
support there.

DiffTrain build for commit https://github.com/facebook/react/commit/bb66aa3cef4e42aee790200d03cf7a82659da121.
This commit is contained in:
jackpope
2024-03-26 22:57:53 +00:00
parent dd1d24bb68
commit ab96eb34b0
4 changed files with 16 additions and 14 deletions
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<270144e142689aae36510575078767a1>>
* @generated SignedSource<<c87024931f160e9769cdcf58bdec1a68>>
*/
"use strict";
@@ -148,6 +148,7 @@ if (__DEV__) {
var enableLegacyHidden = false;
var enableAsyncActions = true;
var alwaysThrottleRetries = true;
var disableLegacyMode = false;
var enableBigIntSupport = false; // Flow magic to verify the exports of this file match the original version.
var FunctionComponent = 0;
@@ -25508,7 +25509,7 @@ if (__DEV__) {
return root;
}
var ReactVersion = "19.0.0-canary-a9ccb423";
var ReactVersion = "19.0.0-canary-ab33cef8";
// Might add PROFILE later.
@@ -26402,7 +26403,8 @@ if (__DEV__) {
function create(element, options) {
var createNodeMock = defaultTestOptions.createNodeMock;
var isConcurrent = false;
var isConcurrentOnly = disableLegacyMode === true;
var isConcurrent = isConcurrentOnly;
var isStrictMode = false;
var concurrentUpdatesByDefault = null;
@@ -26412,8 +26414,8 @@ if (__DEV__) {
createNodeMock = options.createNodeMock;
}
if (options.unstable_isConcurrent === true) {
isConcurrent = true;
{
isConcurrent = options.unstable_isConcurrent;
}
if (options.unstable_strictMode === true) {
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<a75b0d81ed7e65574a940500686411f9>>
* @generated SignedSource<<9e59b85bab1889d947c7a99fc106a97b>>
*/
"use strict";
@@ -9159,7 +9159,7 @@ var devToolsConfig$jscomp$inline_1023 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "19.0.0-canary-1b271a1b",
version: "19.0.0-canary-f55d214e",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1213 = {
@@ -9190,7 +9190,7 @@ var internals$jscomp$inline_1213 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-canary-1b271a1b"
reconcilerVersion: "19.0.0-canary-f55d214e"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1214 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -9216,7 +9216,7 @@ exports.create = function (element, options) {
null !== options &&
("function" === typeof options.createNodeMock &&
(createNodeMock = options.createNodeMock),
!0 === options.unstable_isConcurrent && (isConcurrent = !0),
(isConcurrent = options.unstable_isConcurrent),
!0 === options.unstable_strictMode && (isStrictMode = !0),
void 0 !== options.unstable_concurrentUpdatesByDefault &&
(concurrentUpdatesByDefault =
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<e79f3ae88518b14f6808a7938d5b3e84>>
* @generated SignedSource<<b2573824248edd9931bd15024b146aaa>>
*/
"use strict";
@@ -9585,7 +9585,7 @@ var devToolsConfig$jscomp$inline_1065 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "19.0.0-canary-a6321e7c",
version: "19.0.0-canary-cdabf445",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1254 = {
@@ -9616,7 +9616,7 @@ var internals$jscomp$inline_1254 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-canary-a6321e7c"
reconcilerVersion: "19.0.0-canary-cdabf445"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1255 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -9642,7 +9642,7 @@ exports.create = function (element, options) {
null !== options &&
("function" === typeof options.createNodeMock &&
(createNodeMock = options.createNodeMock),
!0 === options.unstable_isConcurrent && (isConcurrent = !0),
(isConcurrent = options.unstable_isConcurrent),
!0 === options.unstable_strictMode && (isStrictMode = !0),
void 0 !== options.unstable_concurrentUpdatesByDefault &&
(concurrentUpdatesByDefault =
@@ -1 +1 @@
84c84d72f11ff1961a103b3cd59919876e48f759
bb66aa3cef4e42aee790200d03cf7a82659da121