Skip to content

Commit d101850

Browse files
committed
Add stable concurrent option to react-test-renderer (#27804)
## Summary Concurrent rendering has been the default since React 18 release. ReactTestRenderer requires passing `{unstable_isConcurrent: true}` to match this behavior, which means by default tests written with RTR use a different rendering method than the code they test. Eventually, RTR should only use ConcurrentRoot. As a first step, let's add a version of the concurrent option that isn't marked unstable. Next we will follow up with removing the unstable option when it is safe to merge. ## How did you test this change? `yarn test packages/react-test-renderer/src/__tests__/ReactTestRendererAsync-test.js` DiffTrain build for commit b36ae8d.
1 parent 108b7a6 commit d101850

File tree

7 files changed

+32
-27
lines changed

7 files changed

+32
-27
lines changed

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<b7d1bb0f480a798225aca9bde21b4786>>
10+
* @generated SignedSource<<ad4f3cc032aebbca30e14b6cadc89a2a>>
1111
*/
1212

1313
"use strict";
@@ -25474,7 +25474,7 @@ if (__DEV__) {
2547425474
return root;
2547525475
}
2547625476

25477-
var ReactVersion = "18.3.0-canary-be8aa7687-20231206";
25477+
var ReactVersion = "18.3.0-canary-b36ae8d7a-20231207";
2547825478

2547925479
// Might add PROFILE later.
2548025480

@@ -26378,7 +26378,10 @@ if (__DEV__) {
2637826378
createNodeMock = options.createNodeMock;
2637926379
}
2638026380

26381-
if (options.unstable_isConcurrent === true) {
26381+
if (
26382+
options.unstable_isConcurrent === true ||
26383+
options.isConcurrent === true
26384+
) {
2638226385
isConcurrent = true;
2638326386
}
2638426387

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<e0841359e25675fd194913db141bb8f4>>
10+
* @generated SignedSource<<758185a6b91c6a9da438a42c527e57ca>>
1111
*/
1212

1313
"use strict";
@@ -9083,7 +9083,7 @@ var devToolsConfig$jscomp$inline_1033 = {
90839083
throw Error("TestRenderer does not support findFiberByHostInstance()");
90849084
},
90859085
bundleType: 0,
9086-
version: "18.3.0-canary-be8aa7687-20231206",
9086+
version: "18.3.0-canary-b36ae8d7a-20231207",
90879087
rendererPackageName: "react-test-renderer"
90889088
};
90899089
var internals$jscomp$inline_1226 = {
@@ -9114,7 +9114,7 @@ var internals$jscomp$inline_1226 = {
91149114
scheduleRoot: null,
91159115
setRefreshHandler: null,
91169116
getCurrentFiber: null,
9117-
reconcilerVersion: "18.3.0-canary-be8aa7687-20231206"
9117+
reconcilerVersion: "18.3.0-canary-b36ae8d7a-20231207"
91189118
};
91199119
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
91209120
var hook$jscomp$inline_1227 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -9136,15 +9136,16 @@ exports.create = function (element, options) {
91369136
isConcurrent = !1,
91379137
isStrictMode = !1,
91389138
concurrentUpdatesByDefault = null;
9139-
"object" === typeof options &&
9140-
null !== options &&
9141-
("function" === typeof options.createNodeMock &&
9142-
(createNodeMock = options.createNodeMock),
9143-
!0 === options.unstable_isConcurrent && (isConcurrent = !0),
9144-
!0 === options.unstable_strictMode && (isStrictMode = !0),
9139+
if ("object" === typeof options && null !== options) {
9140+
"function" === typeof options.createNodeMock &&
9141+
(createNodeMock = options.createNodeMock);
9142+
if (!0 === options.unstable_isConcurrent || !0 === options.isConcurrent)
9143+
isConcurrent = !0;
9144+
!0 === options.unstable_strictMode && (isStrictMode = !0);
91459145
void 0 !== options.unstable_concurrentUpdatesByDefault &&
91469146
(concurrentUpdatesByDefault =
9147-
options.unstable_concurrentUpdatesByDefault));
9147+
options.unstable_concurrentUpdatesByDefault);
9148+
}
91489149
var container = {
91499150
children: [],
91509151
createNodeMock: createNodeMock,

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<9c511bbcbb96d7f0fe52befe1fc1cbec>>
10+
* @generated SignedSource<<85d704372814074410fc8d3c9e856fbb>>
1111
*/
1212

1313
"use strict";
@@ -9509,7 +9509,7 @@ var devToolsConfig$jscomp$inline_1075 = {
95099509
throw Error("TestRenderer does not support findFiberByHostInstance()");
95109510
},
95119511
bundleType: 0,
9512-
version: "18.3.0-canary-be8aa7687-20231206",
9512+
version: "18.3.0-canary-b36ae8d7a-20231207",
95139513
rendererPackageName: "react-test-renderer"
95149514
};
95159515
var internals$jscomp$inline_1267 = {
@@ -9540,7 +9540,7 @@ var internals$jscomp$inline_1267 = {
95409540
scheduleRoot: null,
95419541
setRefreshHandler: null,
95429542
getCurrentFiber: null,
9543-
reconcilerVersion: "18.3.0-canary-be8aa7687-20231206"
9543+
reconcilerVersion: "18.3.0-canary-b36ae8d7a-20231207"
95449544
};
95459545
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
95469546
var hook$jscomp$inline_1268 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -9562,15 +9562,16 @@ exports.create = function (element, options) {
95629562
isConcurrent = !1,
95639563
isStrictMode = !1,
95649564
concurrentUpdatesByDefault = null;
9565-
"object" === typeof options &&
9566-
null !== options &&
9567-
("function" === typeof options.createNodeMock &&
9568-
(createNodeMock = options.createNodeMock),
9569-
!0 === options.unstable_isConcurrent && (isConcurrent = !0),
9570-
!0 === options.unstable_strictMode && (isStrictMode = !0),
9565+
if ("object" === typeof options && null !== options) {
9566+
"function" === typeof options.createNodeMock &&
9567+
(createNodeMock = options.createNodeMock);
9568+
if (!0 === options.unstable_isConcurrent || !0 === options.isConcurrent)
9569+
isConcurrent = !0;
9570+
!0 === options.unstable_strictMode && (isStrictMode = !0);
95719571
void 0 !== options.unstable_concurrentUpdatesByDefault &&
95729572
(concurrentUpdatesByDefault =
9573-
options.unstable_concurrentUpdatesByDefault));
9573+
options.unstable_concurrentUpdatesByDefault);
9574+
}
95749575
var container = {
95759576
children: [],
95769577
createNodeMock: createNodeMock,

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if (__DEV__) {
2424
) {
2525
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
2626
}
27-
var ReactVersion = "18.3.0-canary-be8aa7687-20231206";
27+
var ReactVersion = "18.3.0-canary-b36ae8d7a-20231207";
2828

2929
// ATTENTION
3030
// When adding new symbols to this file,

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,4 +580,4 @@ exports.useSyncExternalStore = function (
580580
exports.useTransition = function () {
581581
return ReactCurrentDispatcher.current.useTransition();
582582
};
583-
exports.version = "18.3.0-canary-be8aa7687-20231206";
583+
exports.version = "18.3.0-canary-b36ae8d7a-20231207";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ exports.useSyncExternalStore = function (
576576
exports.useTransition = function () {
577577
return ReactCurrentDispatcher.current.useTransition();
578578
};
579-
exports.version = "18.3.0-canary-be8aa7687-20231206";
579+
exports.version = "18.3.0-canary-b36ae8d7a-20231207";
580580
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
581581
"function" ===
582582
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
be8aa76873e231555676483a36534bb48ad1b1a3
1+
b36ae8d7aab94dae285d9d6a1c5f004e6fc19fc9

0 commit comments

Comments
 (0)