Add stable React.act export (#28160)

Starting in version 19, users can import the `act` testing API from the
`react` package instead of using a renderer specific API, like
`react-dom/test-utils`.

DiffTrain build for commit https://github.com/facebook/react/commit/53b12e46a17549ec7644e13c126440ed2f3629fd.
This commit is contained in:
acdlite
2024-02-01 18:33:51 +00:00
parent d9e1e76e05
commit 7cec0cb5a5
7 changed files with 25 additions and 25 deletions
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<dcb3a30556188c6961c11e3ffe2a0c3a>>
* @generated SignedSource<<bd897fcea644b2a95f4293822e1f08be>>
*/
"use strict";
@@ -25623,7 +25623,7 @@ if (__DEV__) {
return root;
}
var ReactVersion = "18.3.0-canary-4384a7bcd-20240201";
var ReactVersion = "18.3.0-canary-53b12e46a-20240201";
// Might add PROFILE later.
@@ -26059,7 +26059,7 @@ if (__DEV__) {
});
}
var act = React.unstable_act; // TODO: Remove from public bundle
var act = React.act; // TODO: Remove from public bundle
var defaultTestOptions = {
createNodeMock: function () {
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<8c4ed2fabb96724eadedb0d542cd9ecf>>
* @generated SignedSource<<8c9395a5b61885f3066e52faeb0c2d89>>
*/
"use strict";
@@ -8845,7 +8845,7 @@ function updateContainer(element, container, parentComponent, callback) {
function emptyFindFiberByHostInstance() {
return null;
}
var act = React.unstable_act,
var act = React.act,
defaultTestOptions = {
createNodeMock: function () {
return null;
@@ -9149,7 +9149,7 @@ var devToolsConfig$jscomp$inline_1031 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-4384a7bcd-20240201",
version: "18.3.0-canary-53b12e46a-20240201",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1207 = {
@@ -9180,7 +9180,7 @@ var internals$jscomp$inline_1207 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-4384a7bcd-20240201"
reconcilerVersion: "18.3.0-canary-53b12e46a-20240201"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1208 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<c27ac45a247951b8b8199e9df960e4cf>>
* @generated SignedSource<<84e7b0d0b02f7624902f32d8515cf248>>
*/
"use strict";
@@ -9273,7 +9273,7 @@ function updateContainer(element, container, parentComponent, callback) {
function emptyFindFiberByHostInstance() {
return null;
}
var act = React.unstable_act,
var act = React.act,
defaultTestOptions = {
createNodeMock: function () {
return null;
@@ -9577,7 +9577,7 @@ var devToolsConfig$jscomp$inline_1073 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-4384a7bcd-20240201",
version: "18.3.0-canary-53b12e46a-20240201",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1248 = {
@@ -9608,7 +9608,7 @@ var internals$jscomp$inline_1248 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-4384a7bcd-20240201"
reconcilerVersion: "18.3.0-canary-53b12e46a-20240201"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1249 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<c41561dadb43d7158811daa4e8000813>>
* @generated SignedSource<<cae14277f9a1460c78070c0b4b0e4d28>>
*/
"use strict";
@@ -24,7 +24,7 @@ if (__DEV__) {
) {
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
}
var ReactVersion = "18.3.0-canary-4384a7bcd-20240201";
var ReactVersion = "18.3.0-canary-53b12e46a-20240201";
// ATTENTION
// When adding new symbols to this file,
@@ -3803,6 +3803,7 @@ if (__DEV__) {
exports.Suspense = REACT_SUSPENSE_TYPE;
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED =
ReactSharedInternals;
exports.act = act;
exports.cache = cache;
exports.cloneElement = cloneElement;
exports.createContext = createContext;
@@ -3825,7 +3826,6 @@ if (__DEV__) {
exports.unstable_Scope = REACT_SCOPE_TYPE;
exports.unstable_SuspenseList = REACT_SUSPENSE_LIST_TYPE;
exports.unstable_TracingMarker = REACT_TRACING_MARKER_TYPE;
exports.unstable_act = act;
exports.unstable_getCacheForType = getCacheForType;
exports.unstable_getCacheSignal = getCacheSignal;
exports.unstable_useCacheRefresh = useCacheRefresh;
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<01a7046607ddd10a45604fb003900a70>>
* @generated SignedSource<<041228aace3ee017428b18b25dc5ebe3>>
*/
"use strict";
@@ -350,6 +350,9 @@ exports.StrictMode = REACT_STRICT_MODE_TYPE;
exports.Suspense = REACT_SUSPENSE_TYPE;
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED =
ReactSharedInternals;
exports.act = function () {
throw Error("act(...) is not supported in production builds of React.");
};
exports.cache = function (fn) {
return function () {
return fn.apply(null, arguments);
@@ -463,9 +466,6 @@ exports.unstable_LegacyHidden = REACT_LEGACY_HIDDEN_TYPE;
exports.unstable_Scope = REACT_SCOPE_TYPE;
exports.unstable_SuspenseList = REACT_SUSPENSE_LIST_TYPE;
exports.unstable_TracingMarker = REACT_TRACING_MARKER_TYPE;
exports.unstable_act = function () {
throw Error("act(...) is not supported in production builds of React.");
};
exports.unstable_getCacheForType = function (resourceType) {
var dispatcher = ReactCurrentCache.current;
return dispatcher ? dispatcher.getCacheForType(resourceType) : resourceType();
@@ -545,4 +545,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-4384a7bcd-20240201";
exports.version = "18.3.0-canary-53b12e46a-20240201";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<877b0f86c9972010f80642430d790525>>
* @generated SignedSource<<a643bb2dfd4641385c3d1cb800cc7fb7>>
*/
"use strict";
@@ -321,6 +321,9 @@ exports.StrictMode = REACT_STRICT_MODE_TYPE;
exports.Suspense = REACT_SUSPENSE_TYPE;
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED =
ReactSharedInternals;
exports.act = function () {
throw Error("act(...) is not supported in production builds of React.");
};
exports.cache = function (fn) {
return function () {
return fn.apply(null, arguments);
@@ -459,9 +462,6 @@ exports.unstable_DebugTracingMode = REACT_DEBUG_TRACING_MODE_TYPE;
exports.unstable_LegacyHidden = REACT_LEGACY_HIDDEN_TYPE;
exports.unstable_Scope = REACT_SCOPE_TYPE;
exports.unstable_SuspenseList = REACT_SUSPENSE_LIST_TYPE;
exports.unstable_act = function () {
throw Error("act(...) is not supported in production builds of React.");
};
exports.unstable_getCacheForType = function (resourceType) {
var dispatcher = ReactCurrentCache.current;
return dispatcher ? dispatcher.getCacheForType(resourceType) : resourceType();
@@ -541,7 +541,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-4384a7bcd-20240201";
exports.version = "18.3.0-canary-53b12e46a-20240201";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
@@ -1 +1 @@
4384a7bcd351c2218c5727a949cf7fff20c3d9d4
53b12e46a17549ec7644e13c126440ed2f3629fd