set initial state explicitly to for consistency
This commit is contained in:
1 parent
ef28f8c38b
commit
12711e87ee
2 files changed
+4
-3
No files matched your search
@@ -43,9 +43,9 @@ export const useMonitorFetch = ({
|
|||||||
triggerUpdate,
|
triggerUpdate,
|
||||||
}) => {
|
}) => {
|
||||||
const [monitorsAreLoading, setMonitorsAreLoading] = useState(false);
|
const [monitorsAreLoading, setMonitorsAreLoading] = useState(false);
|
||||||
const [monitors, setMonitors] = useState([]);
|
const [monitors, setMonitors] = useState(undefined);
|
||||||
const [filteredMonitors, setFilteredMonitors] = useState([]);
|
const [filteredMonitors, setFilteredMonitors] = useState(undefined);
|
||||||
const [monitorsSummary, setMonitorsSummary] = useState({});
|
const [monitorsSummary, setMonitorsSummary] = useState(undefined);
|
||||||
|
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useTheme } from "@mui/material";
|
|||||||
|
|
||||||
const useUtils = () => {
|
const useUtils = () => {
|
||||||
const determineState = (monitor) => {
|
const determineState = (monitor) => {
|
||||||
|
if (typeof monitor === "undefined") return "pending";
|
||||||
if (monitor.isActive === false) return "paused";
|
if (monitor.isActive === false) return "paused";
|
||||||
if (monitor?.status === undefined) return "pending";
|
if (monitor?.status === undefined) return "pending";
|
||||||
return monitor?.status == true ? "up" : "down";
|
return monitor?.status == true ? "up" : "down";
|
||||||
|
|||||||
Reference in new issue
Block a user