Skip to content

Commit

Permalink
Ensure dispatch from useFormState works in StrictMode (#28557)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Clark <[email protected]>

DiffTrain build for commit 8ef14cf.
  • Loading branch information
eps1lon committed Mar 20, 2024
1 parent 4b11556 commit ae299be
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<65b88d386b80bb668ee1220244f5891b>>
* @generated SignedSource<<5b7fff1847563e0ae235d49afe9f4fed>>
*/

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<b8f1ce1ab15d9e71ef26da594ea2a0c5>>
* @generated SignedSource<<a1a8caf6abea70b153a10e435921b3e9>>
*/

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

"use strict";
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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__;
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
37676aba76a9b97e1059e6dec39c3f401f44248d
8ef14cf24219addedca3607dabb3bef37fb2e013
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<d73b12c3f574028ed9e0ad9b51186c44>>
* @generated SignedSource<<eeaebeab7f3f68483a0c03e29c84175e>>
*/

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

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

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

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

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

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

0 comments on commit ae299be

Please sign in to comment.