Skip to content

Commit

Permalink
Add stable React.act export (#28160)
Browse files Browse the repository at this point in the history
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 53b12e4.
  • Loading branch information
acdlite committed Feb 1, 2024
1 parent d9e1e76 commit 7cec0cb
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<dcb3a30556188c6961c11e3ffe2a0c3a>>
* @generated SignedSource<<bd897fcea644b2a95f4293822e1f08be>>
*/

"use strict";
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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 () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<8c4ed2fabb96724eadedb0d542cd9ecf>>
* @generated SignedSource<<8c9395a5b61885f3066e52faeb0c2d89>>
*/

"use strict";
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<c27ac45a247951b8b8199e9df960e4cf>>
* @generated SignedSource<<84e7b0d0b02f7624902f32d8515cf248>>
*/

"use strict";
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<c41561dadb43d7158811daa4e8000813>>
* @generated SignedSource<<cae14277f9a1460c78070c0b4b0e4d28>>
*/

"use strict";
Expand All @@ -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,
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<01a7046607ddd10a45604fb003900a70>>
* @generated SignedSource<<041228aace3ee017428b18b25dc5ebe3>>
*/

"use strict";
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<877b0f86c9972010f80642430d790525>>
* @generated SignedSource<<a643bb2dfd4641385c3d1cb800cc7fb7>>
*/

"use strict";
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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 &&
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4384a7bcd351c2218c5727a949cf7fff20c3d9d4
53b12e46a17549ec7644e13c126440ed2f3629fd

0 comments on commit 7cec0cb

Please sign in to comment.