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 [53b12e4](53b12e4)
  • Loading branch information
acdlite committed Feb 1, 2024
1 parent 72343e6 commit a96ef80
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 32 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1219d57fc9fcbf44c873c0b10e5acbd31f613c15
53b12e46a17549ec7644e13c126440ed2f3629fd
4 changes: 2 additions & 2 deletions compiled/facebook-www/React-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (__DEV__) {
) {
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
}
var ReactVersion = "18.3.0-www-classic-3dc9e724";
var ReactVersion = "18.3.0-www-classic-bdf51244";

// ATTENTION
// When adding new symbols to this file,
Expand Down Expand Up @@ -4161,6 +4161,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 @@ -4183,7 +4184,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
4 changes: 2 additions & 2 deletions compiled/facebook-www/React-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (__DEV__) {
) {
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
}
var ReactVersion = "18.3.0-www-modern-4671cea1";
var ReactVersion = "18.3.0-www-modern-517f857f";

// ATTENTION
// When adding new symbols to this file,
Expand Down Expand Up @@ -4126,6 +4126,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 @@ -4146,7 +4147,6 @@ if (__DEV__) {
exports.unstable_LegacyHidden = REACT_LEGACY_HIDDEN_TYPE;
exports.unstable_Scope = REACT_SCOPE_TYPE;
exports.unstable_SuspenseList = REACT_SUSPENSE_LIST_TYPE;
exports.unstable_act = act;
exports.unstable_getCacheForType = getCacheForType;
exports.unstable_getCacheSignal = getCacheSignal;
exports.unstable_useCacheRefresh = useCacheRefresh;
Expand Down
8 changes: 4 additions & 4 deletions compiled/facebook-www/React-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,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 @@ -490,9 +493,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 @@ -572,4 +572,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-www-classic-d6acec23";
exports.version = "18.3.0-www-classic-8dbe57fc";
8 changes: 4 additions & 4 deletions compiled/facebook-www/React-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,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 @@ -482,9 +485,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 @@ -564,4 +564,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-www-modern-f5a7ea87";
exports.version = "18.3.0-www-modern-f0cc34f4";
8 changes: 4 additions & 4 deletions compiled/facebook-www/React-profiling.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,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 @@ -494,9 +497,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 @@ -576,7 +576,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-www-classic-39df1a5d";
exports.version = "18.3.0-www-classic-65906d0f";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
8 changes: 4 additions & 4 deletions compiled/facebook-www/React-profiling.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,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 @@ -486,9 +489,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 @@ -568,7 +568,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-www-modern-875bec28";
exports.version = "18.3.0-www-modern-bb71daeb";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
6 changes: 3 additions & 3 deletions compiled/facebook-www/ReactDOMTesting-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -17483,7 +17483,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1828 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-classic-3dc9e724",
version: "18.3.0-www-classic-bdf51244",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2197 = {
Expand Down Expand Up @@ -17513,7 +17513,7 @@ var internals$jscomp$inline_2197 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-classic-3dc9e724"
reconcilerVersion: "18.3.0-www-classic-bdf51244"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2198 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -18014,4 +18014,4 @@ exports.useFormStatus = function () {
return ReactCurrentDispatcher$2.current.useHostTransitionStatus();
throw Error(formatProdErrorMessage(248));
};
exports.version = "18.3.0-www-classic-3dc9e724";
exports.version = "18.3.0-www-classic-bdf51244";
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactTestRenderer-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -26078,7 +26078,7 @@ if (__DEV__) {
return root;
}

var ReactVersion = "18.3.0-www-classic-d6acec23";
var ReactVersion = "18.3.0-www-classic-8dbe57fc";

// Might add PROFILE later.

Expand Down Expand Up @@ -26514,7 +26514,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
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactTestRenderer-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -26078,7 +26078,7 @@ if (__DEV__) {
return root;
}

var ReactVersion = "18.3.0-www-modern-e1d67c4c";
var ReactVersion = "18.3.0-www-modern-c904e94a";

// Might add PROFILE later.

Expand Down Expand Up @@ -26514,7 +26514,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
6 changes: 4 additions & 2 deletions compiled/facebook-www/ReactTestUtils-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -1025,8 +1025,10 @@ if (__DEV__) {
var getNodeFromInstance = EventInternals[1];
var getFiberCurrentPropsFromNode = EventInternals[2];
var enqueueStateRestore = EventInternals[3];
var restoreStateIfNeeded = EventInternals[4];
var act = React.unstable_act;
var restoreStateIfNeeded = EventInternals[4]; // TODO: Add a warning if this API is accessed with advice to switch to
// importing directly from the React package instead.

var act = React.act;

function Event(suffix) {}

Expand Down
6 changes: 4 additions & 2 deletions compiled/facebook-www/ReactTestUtils-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -1025,8 +1025,10 @@ if (__DEV__) {
var getNodeFromInstance = EventInternals[1];
var getFiberCurrentPropsFromNode = EventInternals[2];
var enqueueStateRestore = EventInternals[3];
var restoreStateIfNeeded = EventInternals[4];
var act = React.unstable_act;
var restoreStateIfNeeded = EventInternals[4]; // TODO: Add a warning if this API is accessed with advice to switch to
// importing directly from the React package instead.

var act = React.act;

function Event(suffix) {}

Expand Down

0 comments on commit a96ef80

Please sign in to comment.