Fix controlled radios, maybe for real this time (#27443)

Fixes #26876 for real?

In 18.2.0 (last stable), we set .checked unconditionally:

https://github.com/facebook/react/blob/v18.2.0/packages/react-dom/src/client/ReactDOMInput.js#L129-L135

This is important because if we are updating two radios' checkedness
from (false, true) to (true, false), we need to make sure that
input2.checked is explicitly set to false, even though setting
`input1.checked = true` already unchecks input2.

I think this fix is not complete because there is no guarantee that all
the inputs rerender at the same time? Hence the TODO. But in practice
they usually would and I _think_ this is comparable to what we had
before.

Also treating function and symbol as false like we used to and like we
do on initial mount.

DiffTrain build for commit https://github.com/facebook/react/commit/4f4c52a3c8f9c8a2d8133c654841fee257c37249.
This commit is contained in:
sophiebits
2023-10-02 18:43:22 +00:00
parent ff1e90900b
commit 52fa61c618
7 changed files with 9 additions and 9 deletions
@@ -23997,7 +23997,7 @@ function createFiberRoot(
return root;
}
var ReactVersion = "18.3.0-canary-843ec0702-20231002";
var ReactVersion = "18.3.0-canary-4f4c52a3c-20231002";
// Might add PROFILE later.
@@ -8623,7 +8623,7 @@ var devToolsConfig$jscomp$inline_1030 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-843ec0702-20231002",
version: "18.3.0-canary-4f4c52a3c-20231002",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1229 = {
@@ -8654,7 +8654,7 @@ var internals$jscomp$inline_1229 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-843ec0702-20231002"
reconcilerVersion: "18.3.0-canary-4f4c52a3c-20231002"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1230 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -9049,7 +9049,7 @@ var devToolsConfig$jscomp$inline_1072 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-843ec0702-20231002",
version: "18.3.0-canary-4f4c52a3c-20231002",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1270 = {
@@ -9080,7 +9080,7 @@ var internals$jscomp$inline_1270 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-843ec0702-20231002"
reconcilerVersion: "18.3.0-canary-4f4c52a3c-20231002"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1271 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -27,7 +27,7 @@ if (
}
"use strict";
var ReactVersion = "18.3.0-canary-843ec0702-20231002";
var ReactVersion = "18.3.0-canary-4f4c52a3c-20231002";
// ATTENTION
// When adding new symbols to this file,
@@ -616,4 +616,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-843ec0702-20231002";
exports.version = "18.3.0-canary-4f4c52a3c-20231002";
@@ -619,7 +619,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-843ec0702-20231002";
exports.version = "18.3.0-canary-4f4c52a3c-20231002";
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
@@ -1 +1 @@
843ec0702140f2d1e9407a38859abdf5b8dfe4e4
4f4c52a3c8f9c8a2d8133c654841fee257c37249