Skip to content

Commit

Permalink
Fix checkbox and radio hydration (#27401)
Browse files Browse the repository at this point in the history
Fixes whatever part of #26876
and vercel/next.js#49499 that
#27394 didn't fix, probably.

From manual tests I believe this behavior brings us back to parity with
latest stable release (18.2.0). It's awkward that we keep the user's
state even for controlled inputs, so the DOM is out of sync with React
state.

Previously the .defaultChecked assignment done in updateInput() was
changing the actual checkedness because the dirty flag wasn't getting
set, meaning that hydrating could change which radio button is checked,
even in the absence of user interaction! Now we go back to always
detaching again.

DiffTrain build for commit db69f95.
  • Loading branch information
sophiebits committed Oct 2, 2023
1 parent 52fa61c commit cf37a4c
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23997,7 +23997,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-canary-4f4c52a3c-20231002";
var ReactVersion = "18.3.0-canary-db69f95e4-20231002";

// Might add PROFILE later.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8623,7 +8623,7 @@ var devToolsConfig$jscomp$inline_1030 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-4f4c52a3c-20231002",
version: "18.3.0-canary-db69f95e4-20231002",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1229 = {
Expand Down Expand Up @@ -8654,7 +8654,7 @@ var internals$jscomp$inline_1229 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-4f4c52a3c-20231002"
reconcilerVersion: "18.3.0-canary-db69f95e4-20231002"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1230 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9049,7 +9049,7 @@ var devToolsConfig$jscomp$inline_1072 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-4f4c52a3c-20231002",
version: "18.3.0-canary-db69f95e4-20231002",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1270 = {
Expand Down Expand Up @@ -9080,7 +9080,7 @@ var internals$jscomp$inline_1270 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-4f4c52a3c-20231002"
reconcilerVersion: "18.3.0-canary-db69f95e4-20231002"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1271 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-canary-4f4c52a3c-20231002";
var ReactVersion = "18.3.0-canary-db69f95e4-20231002";

// ATTENTION
// When adding new symbols to this file,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,4 +616,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-4f4c52a3c-20231002";
exports.version = "18.3.0-canary-db69f95e4-20231002";
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-4f4c52a3c-20231002";
exports.version = "18.3.0-canary-db69f95e4-20231002";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4f4c52a3c8f9c8a2d8133c654841fee257c37249
db69f95e4876ec3c24117f58d55cbb4f315b9fa7

0 comments on commit cf37a4c

Please sign in to comment.