Fix a react warning in <EntityListComponent>

`entityRef` should only be passed conditionally if component is present, otherwise React logs a warning/error to console.

Signed-off-by: Oliver Sand <oliver.sand@sda-se.com>
This commit is contained in:
Oliver Sand
2021-06-11 12:37:54 +02:00
parent 94fa652dbc
commit 873116e5df
2 changed files with 12 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-import': patch
---
Fix a react warning in `<EntityListComponent>`.
@@ -146,11 +146,15 @@ export const EntityListComponent = ({
<List component="div" disablePadding dense>
{sortEntities(r.entities).map(entity => (
<ListItem
component={withLinks ? EntityRefLink : 'div'}
entityRef={withLinks ? entity : undefined}
button={withLinks as any}
key={formatEntityRefTitle(entity)}
className={classes.nested}
{...(withLinks
? {
component: EntityRefLink,
entityRef: entity,
button: withLinks as any,
}
: {})}
>
<ListItemIcon>{getEntityIcon(entity)}</ListItemIcon>
<ListItemText primary={formatEntityRefTitle(entity)} />