fix uptime chart legends, set initial loading state to true to avoid extra render

This commit is contained in:
Alex Holliday committed 2025-01-31 13:45:07 -08:00
1 parent 49c58ce2ae
commit f218b60591
2 files changed
+4 -2

No files matched your search

@@ -41,6 +41,7 @@ const ChartBoxes = ({
header="Uptime" header="Uptime"
> >
<Stack <Stack
width={"100%"}
justifyContent="space-between" justifyContent="space-between"
direction="row" direction="row"
> >
@@ -93,6 +94,7 @@ const ChartBoxes = ({
icon={<IncidentsIcon />} icon={<IncidentsIcon />}
header="Incidents" header="Incidents"
> >
<Stack width={"100%"}>
<Box position="relative"> <Box position="relative">
<Typography component="span"> <Typography component="span">
{hoveredIncidentsData !== null {hoveredIncidentsData !== null
@@ -113,6 +115,7 @@ const ChartBoxes = ({
</Typography> </Typography>
)} )}
</Box> </Box>
</Stack>
<DownBarChart <DownBarChart
monitor={monitor} monitor={monitor}
type={dateRange} type={dateRange}
@@ -4,14 +4,13 @@ import { logger } from "../../../../Utils/Logger";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
export const useMonitorFetch = ({ authToken, monitorId, dateRange }) => { export const useMonitorFetch = ({ authToken, monitorId, dateRange }) => {
const [monitorIsLoading, setMonitorsIsLoading] = useState(false); const [monitorIsLoading, setMonitorsIsLoading] = useState(true);
const [monitor, setMonitor] = useState(undefined); const [monitor, setMonitor] = useState(undefined);
const navigate = useNavigate(); const navigate = useNavigate();
useEffect(() => { useEffect(() => {
const fetchMonitors = async () => { const fetchMonitors = async () => {
try { try {
setMonitorsIsLoading(true);
const res = await networkService.getUptimeDetailsById({ const res = await networkService.getUptimeDetailsById({
authToken: authToken, authToken: authToken,
monitorId: monitorId, monitorId: monitorId,