Skip to content

Commit ea09d08

Browse files
Brian Vaughnzhengjitf
authored andcommitted
DevTools: Only show StrictMode badge on root elements (facebook#23012)
* DevTools: Only show StrictMode badge on root elements Showing an inline non-compliance badge for every element in the tree is noisy. This commit changes it so that we only show inline icons for root elements (although we continue to show an icon for inspected elements regardless).
1 parent d236bb4 commit ea09d08

File tree

1 file changed

+5
-1
lines changed
  • packages/react-devtools-shared/src/devtools/views/Components

1 file changed

+5
-1
lines changed

packages/react-devtools-shared/src/devtools/views/Components/Element.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ export default function Element({data, index, style}: Props) {
118118
type,
119119
} = ((element: any): ElementType);
120120

121+
// Only show strict mode non-compliance badges for top level elements.
122+
// Showing an inline badge for every element in the tree would be noisy.
123+
const showStrictModeBadge = isStrictModeNonCompliant && depth === 0;
124+
121125
let className = styles.Element;
122126
if (isSelected) {
123127
className = treeFocused
@@ -194,7 +198,7 @@ export default function Element({data, index, style}: Props) {
194198
}
195199
/>
196200
)}
197-
{isStrictModeNonCompliant && (
201+
{showStrictModeBadge && (
198202
<Icon
199203
className={
200204
isSelected && treeFocused

0 commit comments

Comments
 (0)