Skip to content

Commit

Permalink
[DevTools] Hide props section if it is null (#30696)
Browse files Browse the repository at this point in the history
We use null as a marker that we don't know what the props are as opposed
to knowing that they're empty.
  • Loading branch information
sebmarkbage authored Aug 14, 2024
1 parent dd8e0ba commit fca5d65
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,14 @@ export default function InspectedElementPropsTree({
type === ElementTypeClass || canEditFunctionPropsRenamePaths;

const entries = props != null ? Object.entries(props) : null;
if (entries !== null) {
entries.sort(alphaSortEntries);
if (entries === null) {
// Skip the section for null props.
return null;
}

const isEmpty = entries === null || entries.length === 0;
entries.sort(alphaSortEntries);

const isEmpty = entries.length === 0;

const handleCopy = () => copy(serializeDataForCopy(((props: any): Object)));

Expand Down

0 comments on commit fca5d65

Please sign in to comment.