From a96ef807a290ec5284fc1b33d532707287fdbe48 Mon Sep 17 00:00:00 2001 From: acdlite Date: Thu, 1 Feb 2024 18:34:16 +0000 Subject: [PATCH] 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 [53b12e46a17549ec7644e13c126440ed2f3629fd](https://github.com/facebook/react/commit/53b12e46a17549ec7644e13c126440ed2f3629fd) --- compiled/facebook-www/REVISION | 2 +- compiled/facebook-www/React-dev.classic.js | 4 ++-- compiled/facebook-www/React-dev.modern.js | 4 ++-- compiled/facebook-www/React-prod.classic.js | 8 ++++---- compiled/facebook-www/React-prod.modern.js | 8 ++++---- compiled/facebook-www/React-profiling.classic.js | 8 ++++---- compiled/facebook-www/React-profiling.modern.js | 8 ++++---- compiled/facebook-www/ReactDOMTesting-prod.classic.js | 6 +++--- compiled/facebook-www/ReactTestRenderer-dev.classic.js | 4 ++-- compiled/facebook-www/ReactTestRenderer-dev.modern.js | 4 ++-- compiled/facebook-www/ReactTestUtils-dev.classic.js | 6 ++++-- compiled/facebook-www/ReactTestUtils-dev.modern.js | 6 ++++-- 12 files changed, 36 insertions(+), 32 deletions(-) diff --git a/compiled/facebook-www/REVISION b/compiled/facebook-www/REVISION index 4a4dc81e302cd..5fa27b91cf639 100644 --- a/compiled/facebook-www/REVISION +++ b/compiled/facebook-www/REVISION @@ -1 +1 @@ -1219d57fc9fcbf44c873c0b10e5acbd31f613c15 +53b12e46a17549ec7644e13c126440ed2f3629fd diff --git a/compiled/facebook-www/React-dev.classic.js b/compiled/facebook-www/React-dev.classic.js index 3f1a9101f59e2..c4ed7af32f4eb 100644 --- a/compiled/facebook-www/React-dev.classic.js +++ b/compiled/facebook-www/React-dev.classic.js @@ -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, @@ -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; @@ -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; diff --git a/compiled/facebook-www/React-dev.modern.js b/compiled/facebook-www/React-dev.modern.js index c05af382f2c7f..ff021f7e210a8 100644 --- a/compiled/facebook-www/React-dev.modern.js +++ b/compiled/facebook-www/React-dev.modern.js @@ -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, @@ -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; @@ -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; diff --git a/compiled/facebook-www/React-prod.classic.js b/compiled/facebook-www/React-prod.classic.js index ed5aee68e4738..92b56a179cb14 100644 --- a/compiled/facebook-www/React-prod.classic.js +++ b/compiled/facebook-www/React-prod.classic.js @@ -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); @@ -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(); @@ -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"; diff --git a/compiled/facebook-www/React-prod.modern.js b/compiled/facebook-www/React-prod.modern.js index 8ee9afdc4f7a0..0190cc322ab7f 100644 --- a/compiled/facebook-www/React-prod.modern.js +++ b/compiled/facebook-www/React-prod.modern.js @@ -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); @@ -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(); @@ -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"; diff --git a/compiled/facebook-www/React-profiling.classic.js b/compiled/facebook-www/React-profiling.classic.js index 8f7299f260820..4e1e0875a0a26 100644 --- a/compiled/facebook-www/React-profiling.classic.js +++ b/compiled/facebook-www/React-profiling.classic.js @@ -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); @@ -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(); @@ -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 && diff --git a/compiled/facebook-www/React-profiling.modern.js b/compiled/facebook-www/React-profiling.modern.js index 5b9c2b46d116d..bb767a913f3a9 100644 --- a/compiled/facebook-www/React-profiling.modern.js +++ b/compiled/facebook-www/React-profiling.modern.js @@ -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); @@ -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(); @@ -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 && diff --git a/compiled/facebook-www/ReactDOMTesting-prod.classic.js b/compiled/facebook-www/ReactDOMTesting-prod.classic.js index 7b76d9f2e2fee..053a6e69c04d7 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.classic.js @@ -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 = { @@ -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__; @@ -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"; diff --git a/compiled/facebook-www/ReactTestRenderer-dev.classic.js b/compiled/facebook-www/ReactTestRenderer-dev.classic.js index 48b39acbb101a..9364d74de04cc 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.classic.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.classic.js @@ -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. @@ -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 () { diff --git a/compiled/facebook-www/ReactTestRenderer-dev.modern.js b/compiled/facebook-www/ReactTestRenderer-dev.modern.js index bb01e7ac51ee7..60850cb9b2db9 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.modern.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.modern.js @@ -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. @@ -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 () { diff --git a/compiled/facebook-www/ReactTestUtils-dev.classic.js b/compiled/facebook-www/ReactTestUtils-dev.classic.js index f868e9a905b3d..2dfbcdc6a6bd5 100644 --- a/compiled/facebook-www/ReactTestUtils-dev.classic.js +++ b/compiled/facebook-www/ReactTestUtils-dev.classic.js @@ -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) {} diff --git a/compiled/facebook-www/ReactTestUtils-dev.modern.js b/compiled/facebook-www/ReactTestUtils-dev.modern.js index f868e9a905b3d..2dfbcdc6a6bd5 100644 --- a/compiled/facebook-www/ReactTestUtils-dev.modern.js +++ b/compiled/facebook-www/ReactTestUtils-dev.modern.js @@ -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) {}