fix(striker-ui): duck-tape AnvilHost to avoid crash when processing undefined host

main
Tsu-ba-me 3 years ago
parent 0db0a94a05
commit 6692c96835
  1. 6
      striker-ui/components/Hosts/AnvilHost.tsx

@ -75,7 +75,9 @@ const AnvilHost = ({
{hosts && {hosts &&
hosts.map( hosts.map(
(host): JSX.Element => { (host): JSX.Element => {
return ( // Temporary fix: avoid crash when encounter undefined host entry by returning a blank element.
// TODO: figure out why there are undefined host entries.
return host ? (
<InnerPanel key={host.host_uuid}> <InnerPanel key={host.host_uuid}>
<PanelHeader> <PanelHeader>
<Box display="flex" width="100%" className={classes.header}> <Box display="flex" width="100%" className={classes.header}>
@ -153,6 +155,8 @@ const AnvilHost = ({
</> </>
)} )}
</InnerPanel> </InnerPanel>
) : (
<></>
); );
}, },
)} )}

Loading…
Cancel
Save