From 149bec23eb573158cee07e6e876b973cc1f8c761 Mon Sep 17 00:00:00 2001 From: M M Date: Fri, 5 Jul 2024 20:32:54 -0700 Subject: [PATCH] Fixed rendering issues when no monitor data is displayed. --- Client/src/Pages/Details/index.jsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Client/src/Pages/Details/index.jsx b/Client/src/Pages/Details/index.jsx index 75ceab09e..0ccea222d 100644 --- a/Client/src/Pages/Details/index.jsx +++ b/Client/src/Pages/Details/index.jsx @@ -11,7 +11,6 @@ import Typography from '@mui/material/Typography'; import { StatusLabel } from "../../Components/Label/"; import PropTypes from 'prop-types'; -// Styled components const StyledTableCell = styled(TableCell)(({ theme }) => ({ [`&.${tableCellClasses.head}`]: { backgroundColor: theme.palette.action.hover, @@ -41,11 +40,11 @@ function createData(name, date, message) { const CustomizedTables = ({ monitor }) => { const theme = useTheme(); - const rows = monitor.checks.map(check => createData( + const rows = (monitor && monitor.checks) ? monitor.checks.map(check => createData( , new Date(check.createdAt).toLocaleString(), `HTTP ${check.statusCode} - ${check.status ? 'OK' : 'NOK'}` - )); + )) : []; return (