Skip to content

Commit

Permalink
Cleanup enableNewBooleanProps (#28712)
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon authored Apr 2, 2024
1 parent 7659c4d commit 28fc980
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 26 deletions.
3 changes: 1 addition & 2 deletions packages/react-dom-bindings/src/client/ReactDOMComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ function setProp(
}
}
}
// fallthrough for new boolean props without the flag on
// Fallthrough for boolean props that don't have a warning for empty strings.
case 'allowFullScreen':
case 'async':
case 'autoPlay':
Expand Down Expand Up @@ -2783,7 +2783,6 @@ function diffHydratedGenericElement(
serverDifferences,
);
continue;
// fallthrough for new boolean props without the flag on
default: {
if (
// shouldIgnoreAttribute
Expand Down
39 changes: 15 additions & 24 deletions packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js
Original file line number Diff line number Diff line change
Expand Up @@ -1301,6 +1301,21 @@ function pushAttribute(
}
return;
}
case 'inert': {
if (__DEV__) {
if (value === '' && !didWarnForNewBooleanPropsWithEmptyValue[name]) {
didWarnForNewBooleanPropsWithEmptyValue[name] = true;
console.error(
'Received an empty string for a boolean attribute `%s`. ' +
'This will treat the attribute as if it were false. ' +
'Either pass `false` to silence this warning, or ' +
'pass `true` if you used an empty string in earlier versions of React to indicate this attribute is true.',
name,
);
}
}
}
// Fallthrough for boolean props that don't have a warning for empty strings.
case 'allowFullScreen':
case 'async':
case 'autoPlay':
Expand Down Expand Up @@ -1421,30 +1436,6 @@ function pushAttribute(
case 'xmlSpace':
pushStringAttribute(target, 'xml:space', value);
return;
case 'inert': {
if (__DEV__) {
if (value === '' && !didWarnForNewBooleanPropsWithEmptyValue[name]) {
didWarnForNewBooleanPropsWithEmptyValue[name] = true;
console.error(
'Received an empty string for a boolean attribute `%s`. ' +
'This will treat the attribute as if it were false. ' +
'Either pass `false` to silence this warning, or ' +
'pass `true` if you used an empty string in earlier versions of React to indicate this attribute is true.',
name,
);
}
}
// Boolean
if (value && typeof value !== 'function' && typeof value !== 'symbol') {
target.push(
attributeSeparator,
stringToChunk(name),
attributeEmptyString,
);
}
return;
}
// fallthrough for new boolean props without the flag on
default:
if (
// shouldIgnoreAttribute
Expand Down

0 comments on commit 28fc980

Please sign in to comment.