Skip to content

Commit 4451b77

Browse files
committed
Cleanup enableNewBooleanProps
1 parent 6e65010 commit 4451b77

File tree

2 files changed

+16
-26
lines changed

2 files changed

+16
-26
lines changed

packages/react-dom-bindings/src/client/ReactDOMComponent.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ function setProp(
681681
}
682682
}
683683
}
684-
// fallthrough for new boolean props without the flag on
684+
// Fallthrough for boolean props that don't have a warning for empty strings.
685685
case 'allowFullScreen':
686686
case 'async':
687687
case 'autoPlay':
@@ -2783,7 +2783,6 @@ function diffHydratedGenericElement(
27832783
serverDifferences,
27842784
);
27852785
continue;
2786-
// fallthrough for new boolean props without the flag on
27872786
default: {
27882787
if (
27892788
// shouldIgnoreAttribute

packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js

+15-24
Original file line numberDiff line numberDiff line change
@@ -1301,6 +1301,21 @@ function pushAttribute(
13011301
}
13021302
return;
13031303
}
1304+
case 'inert': {
1305+
if (__DEV__) {
1306+
if (value === '' && !didWarnForNewBooleanPropsWithEmptyValue[name]) {
1307+
didWarnForNewBooleanPropsWithEmptyValue[name] = true;
1308+
console.error(
1309+
'Received an empty string for a boolean attribute `%s`. ' +
1310+
'This will treat the attribute as if it were false. ' +
1311+
'Either pass `false` to silence this warning, or ' +
1312+
'pass `true` if you used an empty string in earlier versions of React to indicate this attribute is true.',
1313+
name,
1314+
);
1315+
}
1316+
}
1317+
}
1318+
// Fallthrough for boolean props that don't have a warning for empty strings.
13041319
case 'allowFullScreen':
13051320
case 'async':
13061321
case 'autoPlay':
@@ -1421,30 +1436,6 @@ function pushAttribute(
14211436
case 'xmlSpace':
14221437
pushStringAttribute(target, 'xml:space', value);
14231438
return;
1424-
case 'inert': {
1425-
if (__DEV__) {
1426-
if (value === '' && !didWarnForNewBooleanPropsWithEmptyValue[name]) {
1427-
didWarnForNewBooleanPropsWithEmptyValue[name] = true;
1428-
console.error(
1429-
'Received an empty string for a boolean attribute `%s`. ' +
1430-
'This will treat the attribute as if it were false. ' +
1431-
'Either pass `false` to silence this warning, or ' +
1432-
'pass `true` if you used an empty string in earlier versions of React to indicate this attribute is true.',
1433-
name,
1434-
);
1435-
}
1436-
}
1437-
// Boolean
1438-
if (value && typeof value !== 'function' && typeof value !== 'symbol') {
1439-
target.push(
1440-
attributeSeparator,
1441-
stringToChunk(name),
1442-
attributeEmptyString,
1443-
);
1444-
}
1445-
return;
1446-
}
1447-
// fallthrough for new boolean props without the flag on
14481439
default:
14491440
if (
14501441
// shouldIgnoreAttribute

0 commit comments

Comments
 (0)