mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-04-25 10:28:29 -05:00
safe data access, add default empty view
This commit is contained in:
@@ -32,7 +32,7 @@ import { useTheme } from "@emotion/react";
|
||||
* @returns {JSX.Element} The rendered table component.
|
||||
*/
|
||||
|
||||
const DataTable = ({ headers, data, config }) => {
|
||||
const DataTable = ({ headers, data, config = { emptyView: "No data" } }) => {
|
||||
const theme = useTheme();
|
||||
|
||||
if ((headers?.length ?? 0) === 0) {
|
||||
@@ -58,7 +58,7 @@ const DataTable = ({ headers, data, config }) => {
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
{data.length === 0 ? (
|
||||
{(data?.length ?? 0 === 0) ? (
|
||||
<TableRow>
|
||||
<TableCell
|
||||
colSpan={headers.length}
|
||||
|
||||
Reference in New Issue
Block a user