[DevTools] Hide props section if it is null (#30696)

We use null as a marker that we don't know what the props are as opposed
to knowing that they're empty.
This commit is contained in:
Sebastian Markbåge
2024-08-14 15:48:05 -04:00
committed by GitHub
parent dd8e0ba857
commit fca5d655d7

View File

@@ -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)));