adding nil check on rows before accessing length
This commit is contained in:
parent
4d5713a40c
commit
c4c28a84d6
1 changed files with 3 additions and 3 deletions
|
|
@ -347,7 +347,7 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
|
|||
</Card>
|
||||
)
|
||||
})}
|
||||
{rows.length < 1 &&
|
||||
{(rows && rows.length < 1) &&
|
||||
(!isLoading ?
|
||||
<Typography sx={{ textAlign: "center" }} color="textSecondary">
|
||||
{ noDataMessage ? noDataMessage : "No data."}
|
||||
|
|
@ -430,7 +430,7 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
|
|||
</TableCell>
|
||||
)
|
||||
})
|
||||
: rows.length > 0 &&
|
||||
: (rows && rows.length > 0) &&
|
||||
Object.keys(rows[0]).map((value, index) => {
|
||||
return(
|
||||
<TableCell key={"header-cell-"+index}>
|
||||
|
|
@ -516,7 +516,7 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
|
|||
)
|
||||
})
|
||||
}
|
||||
{rows.length < 1 && !isLoading &&
|
||||
{(rows && rows.length)< 1 && !isLoading &&
|
||||
<TableRow>
|
||||
<TableCell colSpan={6} sx={{textAlign: "center" }}>
|
||||
<Typography variant="body2" color="textSecondary">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue