Add default key to table rows
This commit is contained in:
1 parent
9535ffa192
commit
f5480cbfba
2 files changed
+3
-1
No files matched your search
@@ -82,9 +82,10 @@ const DataTable = ({ headers, data, config = { emptyView: "No data" } }) => {
|
|||||||
</TableRow>
|
</TableRow>
|
||||||
) : (
|
) : (
|
||||||
data.map((row) => {
|
data.map((row) => {
|
||||||
|
const key = row.id || row._id || Math.random();
|
||||||
return (
|
return (
|
||||||
<TableRow
|
<TableRow
|
||||||
key={row.id}
|
key={key}
|
||||||
sx={config?.rowSX ?? {}}
|
sx={config?.rowSX ?? {}}
|
||||||
onClick={() => config?.onRowClick(row)}
|
onClick={() => config?.onRowClick(row)}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ const IncidentTable = ({ monitors, selectedMonitor, filter }) => {
|
|||||||
rowsPerPage,
|
rowsPerPage,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
setChecks(res.data.data.checks);
|
setChecks(res.data.data.checks);
|
||||||
setChecksCount(res.data.data.checksCount);
|
setChecksCount(res.data.data.checksCount);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in new issue
Block a user