diff --git a/src/Charts.tsx b/src/Charts.tsx index 6f2a995..95af6c1 100644 --- a/src/Charts.tsx +++ b/src/Charts.tsx @@ -61,10 +61,13 @@ export const Charts: FunctionComponent = (props) => { ); useEffect(() => { - if (query.env !== env) { - console.log("environment is now: ", env) + if (query.env !== env && query.env) { + console.log("environment is now: ", query.env) setEnv(query.env!); - } + } else if (query.env !== env){ + console.log("environment set to default: prd") + setEnv("prd"); + } }, [query.env, env]) useEffect(() => { @@ -265,15 +268,13 @@ export const Charts: FunctionComponent = (props) => { }, [animationTick]); useEffect(() => { - if (env !== undefined) { + getMetrics() + const timeout = setInterval(async () => { getMetrics() - const timeout = setInterval(async () => { - getMetrics() - }, 60000); - return () => { - clearInterval(timeout); - }; - } + }, 60000); + return () => { + clearInterval(timeout); + }; // eslint-disable-next-line react-hooks/exhaustive-deps }, [env]);