Skip to content

Commit

Permalink
Merge pull request #11 from coveord/fix/UA-8598_globe_values_update_e…
Browse files Browse the repository at this point in the history
…very_minute

fix: globe metrics that update every minute [UA-8598]
  • Loading branch information
mpayne-coveo authored Mar 8, 2024
2 parents 9ee597b + da48a87 commit 259ea45
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/Charts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,13 @@ export const Charts: FunctionComponent<ChartsProps> = (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(() => {
Expand Down Expand Up @@ -265,15 +268,13 @@ export const Charts: FunctionComponent<ChartsProps> = (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]);

Expand Down

0 comments on commit 259ea45

Please sign in to comment.