mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Bugfix: useFormState queues actions in wrong order (#27570)
I neglected to update the "last" pointer of the action queue. Since the queue is circular, rather than dropping the update, the effect was to add the update to the front of the queue instead of the back. I didn't notice earlier because in my demos/tests, the actions would either resolve really quickly or the actions weren't order dependent (like incrementing a counter). DiffTrain build for commit https://github.com/facebook/react/commit/b8e47d988eb3ba547c102c0b12c351250ed955e0.
This commit is contained in:
+3
-3
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<4aba8405b48af51650328aaea1ae0e6d>>
|
||||
* @generated SignedSource<<cbd8ea0713685000d0b28083e1b0ef92>>
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
@@ -8054,7 +8054,7 @@ function dispatchFormState(fiber, actionQueue, setState, payload) {
|
||||
payload: payload,
|
||||
next: first
|
||||
};
|
||||
last.next = _newLast;
|
||||
actionQueue.pending = last.next = _newLast;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24887,7 +24887,7 @@ function createFiberRoot(
|
||||
return root;
|
||||
}
|
||||
|
||||
var ReactVersion = "18.3.0-canary-05fbd1aab-20231023";
|
||||
var ReactVersion = "18.3.0-canary-b8e47d988-20231023";
|
||||
|
||||
// Might add PROFILE later.
|
||||
|
||||
|
||||
+5
-4
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<af98f481db9b1e6f45f4f7d9c8ec7113>>
|
||||
* @generated SignedSource<<3c60c6d80dc890b93e2083f2bdb9724f>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -2694,7 +2694,8 @@ function dispatchFormState(fiber, actionQueue, setState, payload) {
|
||||
? ((fiber = { payload: payload, next: null }),
|
||||
(fiber.next = actionQueue.pending = fiber),
|
||||
runFormStateAction(actionQueue, setState, payload))
|
||||
: (fiber.next = { payload: payload, next: fiber.next });
|
||||
: (actionQueue.pending = fiber.next =
|
||||
{ payload: payload, next: fiber.next });
|
||||
}
|
||||
function runFormStateAction(actionQueue, setState, payload) {
|
||||
var action = actionQueue.action,
|
||||
@@ -9024,7 +9025,7 @@ var devToolsConfig$jscomp$inline_1032 = {
|
||||
throw Error("TestRenderer does not support findFiberByHostInstance()");
|
||||
},
|
||||
bundleType: 0,
|
||||
version: "18.3.0-canary-05fbd1aab-20231023",
|
||||
version: "18.3.0-canary-b8e47d988-20231023",
|
||||
rendererPackageName: "react-test-renderer"
|
||||
};
|
||||
var internals$jscomp$inline_1225 = {
|
||||
@@ -9055,7 +9056,7 @@ var internals$jscomp$inline_1225 = {
|
||||
scheduleRoot: null,
|
||||
setRefreshHandler: null,
|
||||
getCurrentFiber: null,
|
||||
reconcilerVersion: "18.3.0-canary-05fbd1aab-20231023"
|
||||
reconcilerVersion: "18.3.0-canary-b8e47d988-20231023"
|
||||
};
|
||||
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
||||
var hook$jscomp$inline_1226 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
|
||||
+5
-4
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<55d6fdb51293e0bfc3d0f87e833cd9af>>
|
||||
* @generated SignedSource<<a02b9b5dea9f5b94464f6051b23b425e>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -2714,7 +2714,8 @@ function dispatchFormState(fiber, actionQueue, setState, payload) {
|
||||
? ((fiber = { payload: payload, next: null }),
|
||||
(fiber.next = actionQueue.pending = fiber),
|
||||
runFormStateAction(actionQueue, setState, payload))
|
||||
: (fiber.next = { payload: payload, next: fiber.next });
|
||||
: (actionQueue.pending = fiber.next =
|
||||
{ payload: payload, next: fiber.next });
|
||||
}
|
||||
function runFormStateAction(actionQueue, setState, payload) {
|
||||
var action = actionQueue.action,
|
||||
@@ -9450,7 +9451,7 @@ var devToolsConfig$jscomp$inline_1074 = {
|
||||
throw Error("TestRenderer does not support findFiberByHostInstance()");
|
||||
},
|
||||
bundleType: 0,
|
||||
version: "18.3.0-canary-05fbd1aab-20231023",
|
||||
version: "18.3.0-canary-b8e47d988-20231023",
|
||||
rendererPackageName: "react-test-renderer"
|
||||
};
|
||||
var internals$jscomp$inline_1266 = {
|
||||
@@ -9481,7 +9482,7 @@ var internals$jscomp$inline_1266 = {
|
||||
scheduleRoot: null,
|
||||
setRefreshHandler: null,
|
||||
getCurrentFiber: null,
|
||||
reconcilerVersion: "18.3.0-canary-05fbd1aab-20231023"
|
||||
reconcilerVersion: "18.3.0-canary-b8e47d988-20231023"
|
||||
};
|
||||
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
||||
var hook$jscomp$inline_1267 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ if (
|
||||
}
|
||||
"use strict";
|
||||
|
||||
var ReactVersion = "18.3.0-canary-05fbd1aab-20231023";
|
||||
var ReactVersion = "18.3.0-canary-b8e47d988-20231023";
|
||||
|
||||
// ATTENTION
|
||||
// When adding new symbols to this file,
|
||||
|
||||
+1
-1
@@ -580,4 +580,4 @@ exports.useSyncExternalStore = function (
|
||||
exports.useTransition = function () {
|
||||
return ReactCurrentDispatcher.current.useTransition();
|
||||
};
|
||||
exports.version = "18.3.0-canary-05fbd1aab-20231023";
|
||||
exports.version = "18.3.0-canary-b8e47d988-20231023";
|
||||
|
||||
+1
-1
@@ -583,7 +583,7 @@ exports.useSyncExternalStore = function (
|
||||
exports.useTransition = function () {
|
||||
return ReactCurrentDispatcher.current.useTransition();
|
||||
};
|
||||
exports.version = "18.3.0-canary-05fbd1aab-20231023";
|
||||
exports.version = "18.3.0-canary-b8e47d988-20231023";
|
||||
|
||||
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
||||
if (
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
05fbd1aab036ecbd14469d6376024439bc931f68
|
||||
b8e47d988eb3ba547c102c0b12c351250ed955e0
|
||||
|
||||
Reference in New Issue
Block a user