Skip to content

Commit

Permalink
Remove initOption special case (#26595)
Browse files Browse the repository at this point in the history
This traces back to #6449 and then
another before that.

I think that back then we favored the property over the attribute, and
setting the property wouldn't be enough. However, the default path for
these are now using attributes if we don't special case it. So we don't
need it.

The only difference is that we currently have a divergence for
symbol/function behavior between controlled values that use the
getToStringValue helpers which treat them as empty string, where as
everywhere else they're treated as null/missing.

Since this comes with a warning and is a weird error case, it's probably
fine to change.

DiffTrain build for [343a45f](343a45f)
  • Loading branch information
sebmarkbage committed Apr 11, 2023
1 parent e2c8a46 commit fa65896
Show file tree
Hide file tree
Showing 15 changed files with 111 additions and 151 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
58742c21b8c3237e8b66c7df4e200504846a01ae
343a45ffa48065e60699bbe68f82d7b62fa02840
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-www-modern-c910362f";
var ReactVersion = "18.3.0-www-modern-6befcd4c";

// ATTENTION
// When adding new symbols to this file,
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactART-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
return self;
}

var ReactVersion = "18.3.0-www-classic-e55ff31a";
var ReactVersion = "18.3.0-www-classic-23097578";

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactART-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -9675,7 +9675,7 @@ var slice = Array.prototype.slice,
return null;
},
bundleType: 0,
version: "18.3.0-www-modern-6d893aea",
version: "18.3.0-www-modern-a2dd0337",
rendererPackageName: "react-art"
};
var internals$jscomp$inline_1309 = {
Expand Down Expand Up @@ -9706,7 +9706,7 @@ var internals$jscomp$inline_1309 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-modern-6d893aea"
reconcilerVersion: "18.3.0-www-modern-a2dd0337"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1310 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
9 changes: 1 addition & 8 deletions compiled/facebook-www/ReactDOM-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -4098,12 +4098,6 @@ function validateOptionProps(element, props) {
}
}
}
function initOption(element, props) {
// value="" should make a value attribute (#6219)
if (props.value != null) {
element.setAttribute("value", toString(getToStringValue(props.value)));
}
}

var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare

Expand Down Expand Up @@ -33779,7 +33773,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-www-classic-e3eacb5a";
var ReactVersion = "18.3.0-www-classic-911d0261";

function createPortal$1(
children,
Expand Down Expand Up @@ -39063,7 +39057,6 @@ function setInitialProperties(domElement, tag, props) {
}
}

initOption(domElement, props);
return;
}

Expand Down
9 changes: 1 addition & 8 deletions compiled/facebook-www/ReactDOM-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -3932,12 +3932,6 @@ function validateOptionProps(element, props) {
}
}
}
function initOption(element, props) {
// value="" should make a value attribute (#6219)
if (props.value != null) {
element.setAttribute("value", toString(getToStringValue(props.value)));
}
}

var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare

Expand Down Expand Up @@ -33615,7 +33609,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-www-modern-6d893aea";
var ReactVersion = "18.3.0-www-modern-a2dd0337";

function createPortal$1(
children,
Expand Down Expand Up @@ -39565,7 +39559,6 @@ function setInitialProperties(domElement, tag, props) {
}
}

initOption(domElement, props);
return;
}

Expand Down
34 changes: 16 additions & 18 deletions compiled/facebook-www/ReactDOM-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -14143,8 +14143,6 @@ function setInitialProperties(domElement, tag, props) {
default:
setProp(domElement, tag, propKey$201, propKey, props);
}
null != props.value &&
domElement.setAttribute("value", "" + getToStringValue(props.value));
return;
case "dialog":
listenToNonDelegatedEvent("cancel", domElement);
Expand Down Expand Up @@ -16329,17 +16327,17 @@ Internals.Events = [
restoreStateIfNeeded,
batchedUpdates$1
];
var devToolsConfig$jscomp$inline_1841 = {
var devToolsConfig$jscomp$inline_1838 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-classic-ded49a3c",
version: "18.3.0-www-classic-3325ddf4",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2201 = {
bundleType: devToolsConfig$jscomp$inline_1841.bundleType,
version: devToolsConfig$jscomp$inline_1841.version,
rendererPackageName: devToolsConfig$jscomp$inline_1841.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1841.rendererConfig,
var internals$jscomp$inline_2198 = {
bundleType: devToolsConfig$jscomp$inline_1838.bundleType,
version: devToolsConfig$jscomp$inline_1838.version,
rendererPackageName: devToolsConfig$jscomp$inline_1838.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1838.rendererConfig,
overrideHookState: null,
overrideHookStateDeletePath: null,
overrideHookStateRenamePath: null,
Expand All @@ -16355,26 +16353,26 @@ var internals$jscomp$inline_2201 = {
return null === fiber ? null : fiber.stateNode;
},
findFiberByHostInstance:
devToolsConfig$jscomp$inline_1841.findFiberByHostInstance ||
devToolsConfig$jscomp$inline_1838.findFiberByHostInstance ||
emptyFindFiberByHostInstance,
findHostInstancesForRefresh: null,
scheduleRefresh: null,
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-classic-ded49a3c"
reconcilerVersion: "18.3.0-www-classic-3325ddf4"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2202 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
var hook$jscomp$inline_2199 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
if (
!hook$jscomp$inline_2202.isDisabled &&
hook$jscomp$inline_2202.supportsFiber
!hook$jscomp$inline_2199.isDisabled &&
hook$jscomp$inline_2199.supportsFiber
)
try {
(rendererID = hook$jscomp$inline_2202.inject(
internals$jscomp$inline_2201
(rendererID = hook$jscomp$inline_2199.inject(
internals$jscomp$inline_2198
)),
(injectedHook = hook$jscomp$inline_2202);
(injectedHook = hook$jscomp$inline_2199);
} catch (err) {}
}
assign(Internals, {
Expand Down Expand Up @@ -16602,4 +16600,4 @@ exports.unstable_renderSubtreeIntoContainer = function (
);
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-www-classic-ded49a3c";
exports.version = "18.3.0-www-classic-3325ddf4";
34 changes: 16 additions & 18 deletions compiled/facebook-www/ReactDOM-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -14375,8 +14375,6 @@ function setInitialProperties(domElement, tag, props) {
default:
setProp(domElement, tag, propKey$205, propKey, props);
}
null != props.value &&
domElement.setAttribute("value", "" + getToStringValue(props.value));
return;
case "dialog":
listenToNonDelegatedEvent("cancel", domElement);
Expand Down Expand Up @@ -15857,17 +15855,17 @@ Internals.Events = [
restoreStateIfNeeded,
batchedUpdates$1
];
var devToolsConfig$jscomp$inline_1800 = {
var devToolsConfig$jscomp$inline_1797 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-modern-b596b6b5",
version: "18.3.0-www-modern-dc667d26",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2165 = {
bundleType: devToolsConfig$jscomp$inline_1800.bundleType,
version: devToolsConfig$jscomp$inline_1800.version,
rendererPackageName: devToolsConfig$jscomp$inline_1800.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1800.rendererConfig,
var internals$jscomp$inline_2162 = {
bundleType: devToolsConfig$jscomp$inline_1797.bundleType,
version: devToolsConfig$jscomp$inline_1797.version,
rendererPackageName: devToolsConfig$jscomp$inline_1797.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1797.rendererConfig,
overrideHookState: null,
overrideHookStateDeletePath: null,
overrideHookStateRenamePath: null,
Expand All @@ -15884,26 +15882,26 @@ var internals$jscomp$inline_2165 = {
return null === fiber ? null : fiber.stateNode;
},
findFiberByHostInstance:
devToolsConfig$jscomp$inline_1800.findFiberByHostInstance ||
devToolsConfig$jscomp$inline_1797.findFiberByHostInstance ||
emptyFindFiberByHostInstance,
findHostInstancesForRefresh: null,
scheduleRefresh: null,
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-modern-b596b6b5"
reconcilerVersion: "18.3.0-www-modern-dc667d26"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2166 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
var hook$jscomp$inline_2163 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
if (
!hook$jscomp$inline_2166.isDisabled &&
hook$jscomp$inline_2166.supportsFiber
!hook$jscomp$inline_2163.isDisabled &&
hook$jscomp$inline_2163.supportsFiber
)
try {
(rendererID = hook$jscomp$inline_2166.inject(
internals$jscomp$inline_2165
(rendererID = hook$jscomp$inline_2163.inject(
internals$jscomp$inline_2162
)),
(injectedHook = hook$jscomp$inline_2166);
(injectedHook = hook$jscomp$inline_2163);
} catch (err) {}
}
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals;
Expand Down Expand Up @@ -16059,4 +16057,4 @@ exports.unstable_createEventHandle = function (type, options) {
return eventHandle;
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-www-modern-b596b6b5";
exports.version = "18.3.0-www-modern-dc667d26";
20 changes: 9 additions & 11 deletions compiled/facebook-www/ReactDOM-profiling.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -14917,8 +14917,6 @@ function setInitialProperties(domElement, tag, props) {
default:
setProp(domElement, tag, propKey$222, propKey, props);
}
null != props.value &&
domElement.setAttribute("value", "" + getToStringValue(props.value));
return;
case "dialog":
listenToNonDelegatedEvent("cancel", domElement);
Expand Down Expand Up @@ -17103,10 +17101,10 @@ Internals.Events = [
restoreStateIfNeeded,
batchedUpdates$1
];
var devToolsConfig$jscomp$inline_1920 = {
var devToolsConfig$jscomp$inline_1917 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-classic-c5e22311",
version: "18.3.0-www-classic-dfa170b8",
rendererPackageName: "react-dom"
};
(function (internals) {
Expand All @@ -17124,10 +17122,10 @@ var devToolsConfig$jscomp$inline_1920 = {
} catch (err) {}
return hook.checkDCE ? !0 : !1;
})({
bundleType: devToolsConfig$jscomp$inline_1920.bundleType,
version: devToolsConfig$jscomp$inline_1920.version,
rendererPackageName: devToolsConfig$jscomp$inline_1920.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1920.rendererConfig,
bundleType: devToolsConfig$jscomp$inline_1917.bundleType,
version: devToolsConfig$jscomp$inline_1917.version,
rendererPackageName: devToolsConfig$jscomp$inline_1917.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1917.rendererConfig,
overrideHookState: null,
overrideHookStateDeletePath: null,
overrideHookStateRenamePath: null,
Expand All @@ -17143,14 +17141,14 @@ var devToolsConfig$jscomp$inline_1920 = {
return null === fiber ? null : fiber.stateNode;
},
findFiberByHostInstance:
devToolsConfig$jscomp$inline_1920.findFiberByHostInstance ||
devToolsConfig$jscomp$inline_1917.findFiberByHostInstance ||
emptyFindFiberByHostInstance,
findHostInstancesForRefresh: null,
scheduleRefresh: null,
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-classic-c5e22311"
reconcilerVersion: "18.3.0-www-classic-dfa170b8"
});
assign(Internals, {
ReactBrowserEventEmitter: {
Expand Down Expand Up @@ -17377,7 +17375,7 @@ exports.unstable_renderSubtreeIntoContainer = function (
);
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-www-classic-c5e22311";
exports.version = "18.3.0-www-classic-dfa170b8";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
20 changes: 9 additions & 11 deletions compiled/facebook-www/ReactDOM-profiling.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -15143,8 +15143,6 @@ function setInitialProperties(domElement, tag, props) {
default:
setProp(domElement, tag, propKey$226, propKey, props);
}
null != props.value &&
domElement.setAttribute("value", "" + getToStringValue(props.value));
return;
case "dialog":
listenToNonDelegatedEvent("cancel", domElement);
Expand Down Expand Up @@ -16625,10 +16623,10 @@ Internals.Events = [
restoreStateIfNeeded,
batchedUpdates$1
];
var devToolsConfig$jscomp$inline_1879 = {
var devToolsConfig$jscomp$inline_1876 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-modern-f255a7e3",
version: "18.3.0-www-modern-e043269d",
rendererPackageName: "react-dom"
};
(function (internals) {
Expand All @@ -16646,10 +16644,10 @@ var devToolsConfig$jscomp$inline_1879 = {
} catch (err) {}
return hook.checkDCE ? !0 : !1;
})({
bundleType: devToolsConfig$jscomp$inline_1879.bundleType,
version: devToolsConfig$jscomp$inline_1879.version,
rendererPackageName: devToolsConfig$jscomp$inline_1879.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1879.rendererConfig,
bundleType: devToolsConfig$jscomp$inline_1876.bundleType,
version: devToolsConfig$jscomp$inline_1876.version,
rendererPackageName: devToolsConfig$jscomp$inline_1876.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1876.rendererConfig,
overrideHookState: null,
overrideHookStateDeletePath: null,
overrideHookStateRenamePath: null,
Expand All @@ -16666,14 +16664,14 @@ var devToolsConfig$jscomp$inline_1879 = {
return null === fiber ? null : fiber.stateNode;
},
findFiberByHostInstance:
devToolsConfig$jscomp$inline_1879.findFiberByHostInstance ||
devToolsConfig$jscomp$inline_1876.findFiberByHostInstance ||
emptyFindFiberByHostInstance,
findHostInstancesForRefresh: null,
scheduleRefresh: null,
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-modern-f255a7e3"
reconcilerVersion: "18.3.0-www-modern-e043269d"
});
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals;
exports.createPortal = function (children, container) {
Expand Down Expand Up @@ -16828,7 +16826,7 @@ exports.unstable_createEventHandle = function (type, options) {
return eventHandle;
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-www-modern-f255a7e3";
exports.version = "18.3.0-www-modern-e043269d";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
Loading

0 comments on commit fa65896

Please sign in to comment.