From ae299be9fe0462eead8bf87443f8122ad3f45ba9 Mon Sep 17 00:00:00 2001 From: eps1lon Date: Wed, 20 Mar 2024 15:20:01 +0000 Subject: [PATCH] Ensure dispatch from `useFormState` works in `StrictMode` (#28557) Co-authored-by: Andrew Clark DiffTrain build for commit https://github.com/facebook/react/commit/8ef14cf24219addedca3607dabb3bef37fb2e013. --- .../react-test-renderer/cjs/ReactTestRenderer-dev.js | 9 ++++++--- .../react-test-renderer/cjs/ReactTestRenderer-prod.js | 7 ++++--- .../cjs/ReactTestRenderer-profiling.js | 7 ++++--- .../js/react-native-github/Libraries/Renderer/REVISION | 2 +- .../Renderer/implementations/ReactFabric-dev.fb.js | 9 ++++++--- .../Renderer/implementations/ReactFabric-prod.fb.js | 7 ++++--- .../Renderer/implementations/ReactFabric-profiling.fb.js | 7 ++++--- .../implementations/ReactNativeRenderer-dev.fb.js | 9 ++++++--- .../implementations/ReactNativeRenderer-prod.fb.js | 7 ++++--- .../implementations/ReactNativeRenderer-profiling.fb.js | 7 ++++--- 10 files changed, 43 insertions(+), 28 deletions(-) diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js index 859a32f758d56..0de95cf4b84bb 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<65b88d386b80bb668ee1220244f5891b>> + * @generated SignedSource<<5b7fff1847563e0ae235d49afe9f4fed>> */ "use strict"; @@ -8758,7 +8758,10 @@ if (__DEV__) { if (currentStateHook !== null) { // This is an update. Process the update queue. return updateFormStateImpl(stateHook, currentStateHook, action); - } // This is a mount. No updates to process. + } + + updateWorkInProgressHook(); // State + // This is a mount. No updates to process. var state = stateHook.memoizedState; var actionQueueHook = updateWorkInProgressHook(); @@ -25454,7 +25457,7 @@ if (__DEV__) { return root; } - var ReactVersion = "18.3.0-canary-92eb08bf"; + var ReactVersion = "18.3.0-canary-af06220a"; // Might add PROFILE later. diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js index 2eb979bfef744..967907b0b67f8 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<> */ "use strict"; @@ -3415,6 +3415,7 @@ HooksDispatcherOnRerender.useFormState = function (action) { currentStateHook = currentHook; if (null !== currentStateHook) return updateFormStateImpl(stateHook, currentStateHook, action); + updateWorkInProgressHook(); stateHook = stateHook.memoizedState; currentStateHook = updateWorkInProgressHook(); var dispatch = currentStateHook.queue.dispatch; @@ -9175,7 +9176,7 @@ var devToolsConfig$jscomp$inline_1016 = { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 0, - version: "18.3.0-canary-6f5548e2", + version: "18.3.0-canary-6abdf9ee", rendererPackageName: "react-test-renderer" }; var internals$jscomp$inline_1194 = { @@ -9206,7 +9207,7 @@ var internals$jscomp$inline_1194 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-6f5548e2" + reconcilerVersion: "18.3.0-canary-6abdf9ee" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1195 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js index 7ece13ca67daa..8cd048c19dbd4 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<6adce1bb96c74af6db54e6a23f64cd73>> + * @generated SignedSource<> */ "use strict"; @@ -3435,6 +3435,7 @@ HooksDispatcherOnRerender.useFormState = function (action) { currentStateHook = currentHook; if (null !== currentStateHook) return updateFormStateImpl(stateHook, currentStateHook, action); + updateWorkInProgressHook(); stateHook = stateHook.memoizedState; currentStateHook = updateWorkInProgressHook(); var dispatch = currentStateHook.queue.dispatch; @@ -9603,7 +9604,7 @@ var devToolsConfig$jscomp$inline_1058 = { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 0, - version: "18.3.0-canary-0044a36e", + version: "18.3.0-canary-4a9f4278", rendererPackageName: "react-test-renderer" }; var internals$jscomp$inline_1235 = { @@ -9634,7 +9635,7 @@ var internals$jscomp$inline_1235 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-0044a36e" + reconcilerVersion: "18.3.0-canary-4a9f4278" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1236 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION index be87f3175267b..5732366b99979 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION @@ -1 +1 @@ -37676aba76a9b97e1059e6dec39c3f401f44248d +8ef14cf24219addedca3607dabb3bef37fb2e013 diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js index 513df46643076..0b622331fabfb 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<> */ "use strict"; @@ -12589,7 +12589,10 @@ to return true:wantsResponderID| | if (currentStateHook !== null) { // This is an update. Process the update queue. return updateFormStateImpl(stateHook, currentStateHook, action); - } // This is a mount. No updates to process. + } + + updateWorkInProgressHook(); // State + // This is a mount. No updates to process. var state = stateHook.memoizedState; var actionQueueHook = updateWorkInProgressHook(); @@ -29803,7 +29806,7 @@ to return true:wantsResponderID| | return root; } - var ReactVersion = "18.3.0-canary-0088978b"; + var ReactVersion = "18.3.0-canary-dec7bc1a"; function createPortal$1( children, diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js index c17f31c7cd3eb..de4af6a9231f2 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<76e0b4003bdf70163d2f0469bd2eb002>> */ "use strict"; @@ -4419,6 +4419,7 @@ function rerenderFormState(action) { currentStateHook = currentHook; if (null !== currentStateHook) return updateFormStateImpl(stateHook, currentStateHook, action); + updateWorkInProgressHook(); stateHook = stateHook.memoizedState; currentStateHook = updateWorkInProgressHook(); var dispatch = currentStateHook.queue.dispatch; @@ -10628,7 +10629,7 @@ var roots = new Map(), devToolsConfig$jscomp$inline_1103 = { findFiberByHostInstance: getInstanceFromNode, bundleType: 0, - version: "18.3.0-canary-42c2e87d", + version: "18.3.0-canary-f7821092", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -10671,7 +10672,7 @@ var internals$jscomp$inline_1330 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-42c2e87d" + reconcilerVersion: "18.3.0-canary-f7821092" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1331 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js index c8e34e7dcf47e..9c5d357ceda2f 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<92a5460b92f7a609cb3fc8d6b726415d>> + * @generated SignedSource<<652d343c3fa5159faa35c67f06ad300f>> */ "use strict"; @@ -4543,6 +4543,7 @@ function rerenderFormState(action) { currentStateHook = currentHook; if (null !== currentStateHook) return updateFormStateImpl(stateHook, currentStateHook, action); + updateWorkInProgressHook(); stateHook = stateHook.memoizedState; currentStateHook = updateWorkInProgressHook(); var dispatch = currentStateHook.queue.dispatch; @@ -11334,7 +11335,7 @@ var roots = new Map(), devToolsConfig$jscomp$inline_1184 = { findFiberByHostInstance: getInstanceFromNode, bundleType: 0, - version: "18.3.0-canary-40c1e627", + version: "18.3.0-canary-7fdd2689", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -11390,7 +11391,7 @@ var roots = new Map(), scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-40c1e627" + reconcilerVersion: "18.3.0-canary-7fdd2689" }); exports.createPortal = function (children, containerTag) { return createPortal$1( diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js index bf41dd5c7ae73..139abef762231 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<439efd7bd2891caf5884fee0ab29b3e4>> + * @generated SignedSource<> */ "use strict"; @@ -12860,7 +12860,10 @@ to return true:wantsResponderID| | if (currentStateHook !== null) { // This is an update. Process the update queue. return updateFormStateImpl(stateHook, currentStateHook, action); - } // This is a mount. No updates to process. + } + + updateWorkInProgressHook(); // State + // This is a mount. No updates to process. var state = stateHook.memoizedState; var actionQueueHook = updateWorkInProgressHook(); @@ -30243,7 +30246,7 @@ to return true:wantsResponderID| | return root; } - var ReactVersion = "18.3.0-canary-a25c002c"; + var ReactVersion = "18.3.0-canary-f9d3cc00"; function createPortal$1( children, diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js index c2b103b473e27..c2f3a4603a7c3 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<947b8a5cbd0480f4727fbec07ddddb72>> */ "use strict"; @@ -4485,6 +4485,7 @@ function rerenderFormState(action) { currentStateHook = currentHook; if (null !== currentStateHook) return updateFormStateImpl(stateHook, currentStateHook, action); + updateWorkInProgressHook(); stateHook = stateHook.memoizedState; currentStateHook = updateWorkInProgressHook(); var dispatch = currentStateHook.queue.dispatch; @@ -10845,7 +10846,7 @@ var roots = new Map(), devToolsConfig$jscomp$inline_1172 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "18.3.0-canary-57ef8da6", + version: "18.3.0-canary-a924aea1", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -10888,7 +10889,7 @@ var internals$jscomp$inline_1413 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-57ef8da6" + reconcilerVersion: "18.3.0-canary-a924aea1" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1414 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js index 9d4cfaef548c6..fe51c4a0e6a08 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<19eea38c29b1f9d93f42e5521582b707>> + * @generated SignedSource<<4dbb76d68ecb3254207f81634eb2225a>> */ "use strict"; @@ -4609,6 +4609,7 @@ function rerenderFormState(action) { currentStateHook = currentHook; if (null !== currentStateHook) return updateFormStateImpl(stateHook, currentStateHook, action); + updateWorkInProgressHook(); stateHook = stateHook.memoizedState; currentStateHook = updateWorkInProgressHook(); var dispatch = currentStateHook.queue.dispatch; @@ -11552,7 +11553,7 @@ var roots = new Map(), devToolsConfig$jscomp$inline_1253 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "18.3.0-canary-3c67eef2", + version: "18.3.0-canary-015e7023", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -11608,7 +11609,7 @@ var roots = new Map(), scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-3c67eef2" + reconcilerVersion: "18.3.0-canary-015e7023" }); exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = { computeComponentStackForErrorReporting: function (reactTag) {