Add empty data check

This commit is contained in:
Alex Holliday committed 2024-07-16 14:39:19 -07:00
1 parent 0dca65ff51
commit b23ada11dd
2 files changed
+12 -4

No files matched your search

+7 -3
View File
@@ -77,9 +77,13 @@ const BasicTable = ({ data, paginated }) => {
setPage(0); // Reset to first page after changing rows per page
};
let displayData = paginated
? data.rows.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
: data.rows;
let displayData = [];
if (data && data.rows) {
displayData = paginated
? data.rows.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
: data.rows;
}
if (!data || !data.cols || !data.rows) {
return <div>No data</div>;