Fix data check in tables.

This commit is contained in:
Mike Cao 2020-09-10 21:05:02 -07:00
parent 943c2c73d4
commit 8b9c3350b2

View File

@ -87,7 +87,7 @@ export default function MetricsTable({
</div> </div>
</div> </div>
<div className={styles.body}> <div className={styles.body}>
{data?.length === 0 && ( {rankings?.length === 0 && (
<div className={styles.empty}> <div className={styles.empty}>
<FormattedMessage <FormattedMessage
id="message.no-data-available" id="message.no-data-available"
@ -97,14 +97,14 @@ export default function MetricsTable({
)} )}
{limit {limit
? rankings.map(row => getRow(row)) ? rankings.map(row => getRow(row))
: data?.length > 0 && ( : rankings.length > 0 && (
<FixedSizeList height={500} itemCount={rankings.length} itemSize={30}> <FixedSizeList height={500} itemCount={rankings.length} itemSize={30}>
{Row} {Row}
</FixedSizeList> </FixedSizeList>
)} )}
</div> </div>
<div className={styles.footer}> <div className={styles.footer}>
{limit && data.length > limit && ( {limit && rankings.length > limit && (
<Button icon={<Arrow />} size="xsmall" onClick={() => onExpand(type)}> <Button icon={<Arrow />} size="xsmall" onClick={() => onExpand(type)}>
<div> <div>
<FormattedMessage id="button.more" defaultMessage="More" /> <FormattedMessage id="button.more" defaultMessage="More" />