From ea0a9d94bcaaad25679de7af9c39999cc2402fd1 Mon Sep 17 00:00:00 2001 From: Simon Larsen Date: Fri, 20 Sep 2024 23:32:54 +0100 Subject: [PATCH] Fix null checks for currentStatus in Overview component and update variable declaration for currentMonitorStatus --- StatusPage/src/Pages/Overview/Overview.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/StatusPage/src/Pages/Overview/Overview.tsx b/StatusPage/src/Pages/Overview/Overview.tsx index 78b780e009..0a35b1699c 100644 --- a/StatusPage/src/Pages/Overview/Overview.tsx +++ b/StatusPage/src/Pages/Overview/Overview.tsx @@ -373,7 +373,9 @@ const Overview: FunctionComponent = ( if ( !downtimeMonitorStatuses.find((downtimeStatus: MonitorStatus) => { - return currentStatus.id?.toString() === downtimeStatus.id?.toString(); + return ( + currentStatus?.id?.toString() === downtimeStatus?.id?.toString() + ); }) && data.group.showUptimePercent ) { @@ -723,7 +725,7 @@ const Overview: FunctionComponent = ( getResourcesInGroup(group); for (const resource of resourcesInGroup) { - const currentMonitorStatus: MonitorStatus | undefined = + let currentMonitorStatus: MonitorStatus | undefined = monitorStatuses.find((status: MonitorStatus) => { return ( status._id?.toString() === @@ -731,6 +733,10 @@ const Overview: FunctionComponent = ( ); }); + if (!currentMonitorStatus) { + currentMonitorStatus = currentStatus; + } + if ( (currentStatus && currentStatus.priority &&