Skip to content

Commit

Permalink
DevTools: Only show StrictMode badge on root elements (#23012)
Browse files Browse the repository at this point in the history
* 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).
  • Loading branch information
Brian Vaughn authored Dec 21, 2021
1 parent bd0a5dd commit bcd24a6
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ export default function Element({data, index, style}: Props) {
type,
} = ((element: any): ElementType);

// Only show strict mode non-compliance badges for top level elements.
// Showing an inline badge for every element in the tree would be noisy.
const showStrictModeBadge = isStrictModeNonCompliant && depth === 0;

let className = styles.Element;
if (isSelected) {
className = treeFocused
Expand Down Expand Up @@ -194,7 +198,7 @@ export default function Element({data, index, style}: Props) {
}
/>
)}
{isStrictModeNonCompliant && (
{showStrictModeBadge && (
<Icon
className={
isSelected && treeFocused
Expand Down

0 comments on commit bcd24a6

Please sign in to comment.