Skip to content

Commit a96ef80

Browse files
committed
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 [53b12e4](53b12e4)
1 parent 72343e6 commit a96ef80

12 files changed

+36
-32
lines changed

compiled/facebook-www/REVISION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1219d57fc9fcbf44c873c0b10e5acbd31f613c15
1+
53b12e46a17549ec7644e13c126440ed2f3629fd

compiled/facebook-www/React-dev.classic.js

+2-2
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-www-classic-3dc9e724";
27+
var ReactVersion = "18.3.0-www-classic-bdf51244";
2828

2929
// ATTENTION
3030
// When adding new symbols to this file,
@@ -4161,6 +4161,7 @@ if (__DEV__) {
41614161
exports.Suspense = REACT_SUSPENSE_TYPE;
41624162
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED =
41634163
ReactSharedInternals;
4164+
exports.act = act;
41644165
exports.cache = cache;
41654166
exports.cloneElement = cloneElement;
41664167
exports.createContext = createContext;
@@ -4183,7 +4184,6 @@ if (__DEV__) {
41834184
exports.unstable_Scope = REACT_SCOPE_TYPE;
41844185
exports.unstable_SuspenseList = REACT_SUSPENSE_LIST_TYPE;
41854186
exports.unstable_TracingMarker = REACT_TRACING_MARKER_TYPE;
4186-
exports.unstable_act = act;
41874187
exports.unstable_getCacheForType = getCacheForType;
41884188
exports.unstable_getCacheSignal = getCacheSignal;
41894189
exports.unstable_useCacheRefresh = useCacheRefresh;

compiled/facebook-www/React-dev.modern.js

+2-2
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-www-modern-4671cea1";
27+
var ReactVersion = "18.3.0-www-modern-517f857f";
2828

2929
// ATTENTION
3030
// When adding new symbols to this file,
@@ -4126,6 +4126,7 @@ if (__DEV__) {
41264126
exports.Suspense = REACT_SUSPENSE_TYPE;
41274127
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED =
41284128
ReactSharedInternals;
4129+
exports.act = act;
41294130
exports.cache = cache;
41304131
exports.cloneElement = cloneElement;
41314132
exports.createContext = createContext;
@@ -4146,7 +4147,6 @@ if (__DEV__) {
41464147
exports.unstable_LegacyHidden = REACT_LEGACY_HIDDEN_TYPE;
41474148
exports.unstable_Scope = REACT_SCOPE_TYPE;
41484149
exports.unstable_SuspenseList = REACT_SUSPENSE_LIST_TYPE;
4149-
exports.unstable_act = act;
41504150
exports.unstable_getCacheForType = getCacheForType;
41514151
exports.unstable_getCacheSignal = getCacheSignal;
41524152
exports.unstable_useCacheRefresh = useCacheRefresh;

compiled/facebook-www/React-prod.classic.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,9 @@ exports.StrictMode = REACT_STRICT_MODE_TYPE;
355355
exports.Suspense = REACT_SUSPENSE_TYPE;
356356
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED =
357357
ReactSharedInternals;
358+
exports.act = function () {
359+
throw Error("act(...) is not supported in production builds of React.");
360+
};
358361
exports.cache = function (fn) {
359362
return function () {
360363
return fn.apply(null, arguments);
@@ -490,9 +493,6 @@ exports.unstable_LegacyHidden = REACT_LEGACY_HIDDEN_TYPE;
490493
exports.unstable_Scope = REACT_SCOPE_TYPE;
491494
exports.unstable_SuspenseList = REACT_SUSPENSE_LIST_TYPE;
492495
exports.unstable_TracingMarker = REACT_TRACING_MARKER_TYPE;
493-
exports.unstable_act = function () {
494-
throw Error("act(...) is not supported in production builds of React.");
495-
};
496496
exports.unstable_getCacheForType = function (resourceType) {
497497
var dispatcher = ReactCurrentCache.current;
498498
return dispatcher ? dispatcher.getCacheForType(resourceType) : resourceType();
@@ -572,4 +572,4 @@ exports.useSyncExternalStore = function (
572572
exports.useTransition = function () {
573573
return ReactCurrentDispatcher.current.useTransition();
574574
};
575-
exports.version = "18.3.0-www-classic-d6acec23";
575+
exports.version = "18.3.0-www-classic-8dbe57fc";

compiled/facebook-www/React-prod.modern.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,9 @@ exports.StrictMode = REACT_STRICT_MODE_TYPE;
322322
exports.Suspense = REACT_SUSPENSE_TYPE;
323323
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED =
324324
ReactSharedInternals;
325+
exports.act = function () {
326+
throw Error("act(...) is not supported in production builds of React.");
327+
};
325328
exports.cache = function (fn) {
326329
return function () {
327330
return fn.apply(null, arguments);
@@ -482,9 +485,6 @@ exports.unstable_DebugTracingMode = REACT_DEBUG_TRACING_MODE_TYPE;
482485
exports.unstable_LegacyHidden = REACT_LEGACY_HIDDEN_TYPE;
483486
exports.unstable_Scope = REACT_SCOPE_TYPE;
484487
exports.unstable_SuspenseList = REACT_SUSPENSE_LIST_TYPE;
485-
exports.unstable_act = function () {
486-
throw Error("act(...) is not supported in production builds of React.");
487-
};
488488
exports.unstable_getCacheForType = function (resourceType) {
489489
var dispatcher = ReactCurrentCache.current;
490490
return dispatcher ? dispatcher.getCacheForType(resourceType) : resourceType();
@@ -564,4 +564,4 @@ exports.useSyncExternalStore = function (
564564
exports.useTransition = function () {
565565
return ReactCurrentDispatcher.current.useTransition();
566566
};
567-
exports.version = "18.3.0-www-modern-f5a7ea87";
567+
exports.version = "18.3.0-www-modern-f0cc34f4";

compiled/facebook-www/React-profiling.classic.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,9 @@ exports.StrictMode = REACT_STRICT_MODE_TYPE;
359359
exports.Suspense = REACT_SUSPENSE_TYPE;
360360
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED =
361361
ReactSharedInternals;
362+
exports.act = function () {
363+
throw Error("act(...) is not supported in production builds of React.");
364+
};
362365
exports.cache = function (fn) {
363366
return function () {
364367
return fn.apply(null, arguments);
@@ -494,9 +497,6 @@ exports.unstable_LegacyHidden = REACT_LEGACY_HIDDEN_TYPE;
494497
exports.unstable_Scope = REACT_SCOPE_TYPE;
495498
exports.unstable_SuspenseList = REACT_SUSPENSE_LIST_TYPE;
496499
exports.unstable_TracingMarker = REACT_TRACING_MARKER_TYPE;
497-
exports.unstable_act = function () {
498-
throw Error("act(...) is not supported in production builds of React.");
499-
};
500500
exports.unstable_getCacheForType = function (resourceType) {
501501
var dispatcher = ReactCurrentCache.current;
502502
return dispatcher ? dispatcher.getCacheForType(resourceType) : resourceType();
@@ -576,7 +576,7 @@ exports.useSyncExternalStore = function (
576576
exports.useTransition = function () {
577577
return ReactCurrentDispatcher.current.useTransition();
578578
};
579-
exports.version = "18.3.0-www-classic-39df1a5d";
579+
exports.version = "18.3.0-www-classic-65906d0f";
580580
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
581581
"function" ===
582582
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-profiling.modern.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,9 @@ exports.StrictMode = REACT_STRICT_MODE_TYPE;
326326
exports.Suspense = REACT_SUSPENSE_TYPE;
327327
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED =
328328
ReactSharedInternals;
329+
exports.act = function () {
330+
throw Error("act(...) is not supported in production builds of React.");
331+
};
329332
exports.cache = function (fn) {
330333
return function () {
331334
return fn.apply(null, arguments);
@@ -486,9 +489,6 @@ exports.unstable_DebugTracingMode = REACT_DEBUG_TRACING_MODE_TYPE;
486489
exports.unstable_LegacyHidden = REACT_LEGACY_HIDDEN_TYPE;
487490
exports.unstable_Scope = REACT_SCOPE_TYPE;
488491
exports.unstable_SuspenseList = REACT_SUSPENSE_LIST_TYPE;
489-
exports.unstable_act = function () {
490-
throw Error("act(...) is not supported in production builds of React.");
491-
};
492492
exports.unstable_getCacheForType = function (resourceType) {
493493
var dispatcher = ReactCurrentCache.current;
494494
return dispatcher ? dispatcher.getCacheForType(resourceType) : resourceType();
@@ -568,7 +568,7 @@ exports.useSyncExternalStore = function (
568568
exports.useTransition = function () {
569569
return ReactCurrentDispatcher.current.useTransition();
570570
};
571-
exports.version = "18.3.0-www-modern-875bec28";
571+
exports.version = "18.3.0-www-modern-bb71daeb";
572572
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
573573
"function" ===
574574
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/ReactDOMTesting-prod.classic.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -17483,7 +17483,7 @@ Internals.Events = [
1748317483
var devToolsConfig$jscomp$inline_1828 = {
1748417484
findFiberByHostInstance: getClosestInstanceFromNode,
1748517485
bundleType: 0,
17486-
version: "18.3.0-www-classic-3dc9e724",
17486+
version: "18.3.0-www-classic-bdf51244",
1748717487
rendererPackageName: "react-dom"
1748817488
};
1748917489
var internals$jscomp$inline_2197 = {
@@ -17513,7 +17513,7 @@ var internals$jscomp$inline_2197 = {
1751317513
scheduleRoot: null,
1751417514
setRefreshHandler: null,
1751517515
getCurrentFiber: null,
17516-
reconcilerVersion: "18.3.0-www-classic-3dc9e724"
17516+
reconcilerVersion: "18.3.0-www-classic-bdf51244"
1751717517
};
1751817518
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1751917519
var hook$jscomp$inline_2198 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -18014,4 +18014,4 @@ exports.useFormStatus = function () {
1801418014
return ReactCurrentDispatcher$2.current.useHostTransitionStatus();
1801518015
throw Error(formatProdErrorMessage(248));
1801618016
};
18017-
exports.version = "18.3.0-www-classic-3dc9e724";
18017+
exports.version = "18.3.0-www-classic-bdf51244";

compiled/facebook-www/ReactTestRenderer-dev.classic.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -26078,7 +26078,7 @@ if (__DEV__) {
2607826078
return root;
2607926079
}
2608026080

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

2608326083
// Might add PROFILE later.
2608426084

@@ -26514,7 +26514,7 @@ if (__DEV__) {
2651426514
});
2651526515
}
2651626516

26517-
var act = React.unstable_act; // TODO: Remove from public bundle
26517+
var act = React.act; // TODO: Remove from public bundle
2651826518

2651926519
var defaultTestOptions = {
2652026520
createNodeMock: function () {

compiled/facebook-www/ReactTestRenderer-dev.modern.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -26078,7 +26078,7 @@ if (__DEV__) {
2607826078
return root;
2607926079
}
2608026080

26081-
var ReactVersion = "18.3.0-www-modern-e1d67c4c";
26081+
var ReactVersion = "18.3.0-www-modern-c904e94a";
2608226082

2608326083
// Might add PROFILE later.
2608426084

@@ -26514,7 +26514,7 @@ if (__DEV__) {
2651426514
});
2651526515
}
2651626516

26517-
var act = React.unstable_act; // TODO: Remove from public bundle
26517+
var act = React.act; // TODO: Remove from public bundle
2651826518

2651926519
var defaultTestOptions = {
2652026520
createNodeMock: function () {

compiled/facebook-www/ReactTestUtils-dev.classic.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1025,8 +1025,10 @@ if (__DEV__) {
10251025
var getNodeFromInstance = EventInternals[1];
10261026
var getFiberCurrentPropsFromNode = EventInternals[2];
10271027
var enqueueStateRestore = EventInternals[3];
1028-
var restoreStateIfNeeded = EventInternals[4];
1029-
var act = React.unstable_act;
1028+
var restoreStateIfNeeded = EventInternals[4]; // TODO: Add a warning if this API is accessed with advice to switch to
1029+
// importing directly from the React package instead.
1030+
1031+
var act = React.act;
10301032

10311033
function Event(suffix) {}
10321034

compiled/facebook-www/ReactTestUtils-dev.modern.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1025,8 +1025,10 @@ if (__DEV__) {
10251025
var getNodeFromInstance = EventInternals[1];
10261026
var getFiberCurrentPropsFromNode = EventInternals[2];
10271027
var enqueueStateRestore = EventInternals[3];
1028-
var restoreStateIfNeeded = EventInternals[4];
1029-
var act = React.unstable_act;
1028+
var restoreStateIfNeeded = EventInternals[4]; // TODO: Add a warning if this API is accessed with advice to switch to
1029+
// importing directly from the React package instead.
1030+
1031+
var act = React.act;
10301032

10311033
function Event(suffix) {}
10321034

0 commit comments

Comments
 (0)