diff --git a/src/features/dashboard/components/DashboardGrid.tsx b/src/features/dashboard/components/DashboardGrid.tsx index 1ac2c99..11fa94b 100644 --- a/src/features/dashboard/components/DashboardGrid.tsx +++ b/src/features/dashboard/components/DashboardGrid.tsx @@ -47,9 +47,9 @@ const DashboardGrid = () => { refetch={refetch} />
{isAllGood ? "All systems running" : "Some systems down"}
+ {isError ? ( +Error loading camera health.
+ ) : isAllGood ? ( +All systems running
+ ) : ( +Some systems down
+ )}Loading Camera health...
diff --git a/src/features/dashboard/components/statusGridItem/StatusGridItem.tsx b/src/features/dashboard/components/statusGridItem/StatusGridItem.tsx index faa7032..d3577f2 100644 --- a/src/features/dashboard/components/statusGridItem/StatusGridItem.tsx +++ b/src/features/dashboard/components/statusGridItem/StatusGridItem.tsx @@ -11,7 +11,8 @@ type StatusGridItemProps = { const StatusGridItem = ({ title, statusCategory }: StatusGridItemProps) => { const [isOpen, setIsOpen] = useState(false); - const isAllGood = statusCategory.every((status) => status.tags.includes("RUNNING")); + const isAllGood = + statusCategory && statusCategory.length > 0 && statusCategory.every((status) => status.tags.includes("RUNNING")); const handleClick = () => { setIsOpen(false); diff --git a/src/features/dashboard/components/systemStatus/SystemStatusCard.tsx b/src/features/dashboard/components/systemStatus/SystemStatusCard.tsx index 3017367..6260c0c 100644 --- a/src/features/dashboard/components/systemStatus/SystemStatusCard.tsx +++ b/src/features/dashboard/components/systemStatus/SystemStatusCard.tsx @@ -13,12 +13,21 @@ const SystemStatusCard = () => { const { storeQuery } = useGetStore(); const reads = storeQuery?.data; - const isReadsLoading = storeQuery.isFetching; + const isReadsLoading = storeQuery?.isFetching; + const isError = storeQuery?.isError || !storeQuery?.data; useEffect(() => { storeQuery.refetch(); }, [reads]); + if (isError) { + return ( +