safe variable access

This commit is contained in:
Alex Holliday committed 2025-01-01 17:06:49 -08:00
1 parent 2a41642be7
commit dafdb03ce0
1 file changed
+4 -4
+4 -4
View File
@@ -309,7 +309,7 @@ const DetailsPage = () => {
<Typography component="span"> <Typography component="span">
{hoveredUptimeData !== null {hoveredUptimeData !== null
? hoveredUptimeData.totalChecks ? hoveredUptimeData.totalChecks
: (monitor.stats?.upChecksAggregate.totalChecks ?? 0)} : (monitor.stats?.upChecksAggregate?.totalChecks ?? 0)}
</Typography> </Typography>
{hoveredUptimeData !== null && hoveredUptimeData.time !== null && ( {hoveredUptimeData !== null && hoveredUptimeData.time !== null && (
<Typography <Typography
@@ -340,7 +340,7 @@ const DetailsPage = () => {
{hoveredUptimeData !== null {hoveredUptimeData !== null
? Math.floor(hoveredUptimeData?.avgResponseTime ?? 0) ? Math.floor(hoveredUptimeData?.avgResponseTime ?? 0)
: Math.floor( : Math.floor(
((monitor?.stats?.upChecksAggregate.totalChecks ?? 0) / ((monitor?.stats?.upChecksAggregate?.totalChecks ?? 0) /
(monitor?.stats?.totalChecks ?? 1)) * (monitor?.stats?.totalChecks ?? 1)) *
100 100
)} )}
@@ -368,7 +368,7 @@ const DetailsPage = () => {
<Typography component="span"> <Typography component="span">
{hoveredIncidentsData !== null {hoveredIncidentsData !== null
? hoveredIncidentsData.totalChecks ? hoveredIncidentsData.totalChecks
: (monitor.stats?.downChecksAggregate.totalChecks ?? 0)} : (monitor.stats?.downChecksAggregate?.totalChecks ?? 0)}
</Typography> </Typography>
{hoveredIncidentsData !== null && {hoveredIncidentsData !== null &&
hoveredIncidentsData.time !== null && ( hoveredIncidentsData.time !== null && (
@@ -404,7 +404,7 @@ const DetailsPage = () => {
<Typography component="h2">Average Response Time</Typography> <Typography component="h2">Average Response Time</Typography>
</Stack> </Stack>
<ResponseGaugeChart <ResponseGaugeChart
avgResponseTime={monitor?.stats?.groupAggregate.avgResponseTime ?? 0} avgResponseTime={monitor?.stats?.groupAggregate?.avgResponseTime ?? 0}
/> />
</ChartBox> </ChartBox>
<ChartBox sx={{ padding: 0 }}> <ChartBox sx={{ padding: 0 }}>