[DevTools] Don't show the root as being non-compliant (#34827)

`isStrictModeNonCompliant` on the root just means that it supports
strict mode. It's inherited by other nodes.

It's not possible to opt-in to strict mode on the root itself but rather
right below it. So we should not mark the root as being non-compliant.

This lets you select the root in the suspense tab and it shouldn't show
as red with a warning.
This commit is contained in:
Sebastian Markbåge
2025-10-13 12:11:52 -04:00
committed by GitHub
parent 34b1567427
commit e2ce64acb9

View File

@@ -194,7 +194,7 @@ export default function InspectedElementWrapper(_: Props): React.Node {
}
let strictModeBadge = null;
if (element.isStrictModeNonCompliant) {
if (element.isStrictModeNonCompliant && element.parentID !== 0) {
strictModeBadge = (
<Tooltip label="This component is not running in StrictMode. Click to learn more.">
<a
@@ -237,7 +237,7 @@ export default function InspectedElementWrapper(_: Props): React.Node {
<div className={styles.SelectedComponentName}>
<div
className={
element.isStrictModeNonCompliant
element.isStrictModeNonCompliant && element.parentID !== 0
? `${styles.ComponentName} ${styles.StrictModeNonCompliantComponentName}`
: styles.ComponentName
}