Skip to content

Commit 5dbafca

Browse files
author
Brian Vaughn
committed
Removed redundant .length check
1 parent 313f5e3 commit 5dbafca

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import type {
4545
InspectedElementContextType,
4646
StoreAsGlobal,
4747
} from './InspectedElementContext';
48-
import type {Element, InspectedElement} from './types';
48+
import type {Element, InspectedElement, Owner} from './types';
4949
import type {ElementType} from 'react-devtools-shared/src/types';
5050

5151
export type Props = {||};
@@ -380,10 +380,9 @@ function InspectedElementView({
380380
rendererPackageName !== null && rendererVersion !== null
381381
? `${rendererPackageName}@${rendererVersion}`
382382
: null;
383+
const showOwnersList = owners !== null && owners.length > 0;
383384
const showRenderedBy =
384-
(owners !== null && owners.length > 0) ||
385-
rendererLabel !== null ||
386-
rootType !== null;
385+
showOwnersList || rendererLabel !== null || rootType !== null;
387386

388387
return (
389388
<Fragment>
@@ -429,9 +428,8 @@ function InspectedElementView({
429428
{showRenderedBy && (
430429
<div className={styles.Owners}>
431430
<div className={styles.OwnersHeader}>rendered by</div>
432-
{owners !== null &&
433-
owners.length > 0 &&
434-
owners.map(owner => (
431+
{showOwnersList &&
432+
((owners: any): Array<Owner>).map(owner => (
435433
<OwnerView
436434
key={owner.id}
437435
displayName={owner.displayName || 'Anonymous'}

0 commit comments

Comments
 (0)