Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: globe metrics that update every minute [UA-8598] #11

Merged
merged 13 commits into from
Mar 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading