diff --git a/webapp/src/components/App/Tasks/JobTableView.tsx b/webapp/src/components/App/Tasks/JobTableView.tsx index 1381489764..fd222f86fd 100644 --- a/webapp/src/components/App/Tasks/JobTableView.tsx +++ b/webapp/src/components/App/Tasks/JobTableView.tsx @@ -31,6 +31,7 @@ import usePromiseWithSnackbarError from "../../../hooks/usePromiseWithSnackbarEr import { getLauncherMetrics } from "../../../services/api/study"; import LinearProgressWithLabel from "../../common/LinearProgressWithLabel"; import UsePromiseCond from "../../common/utils/UsePromiseCond"; +import { useInterval } from "react-use"; interface PropType { content: TaskView[]; @@ -46,13 +47,10 @@ function JobTableView(props: PropType) { useState(false); const [currentContent, setCurrentContent] = useState(content); - const laucherMetrics = usePromiseWithSnackbarError( - () => getLauncherMetrics(), - { - errorMessage: t("study.error.launchLoad"), - deps: [], - }, - ); + const launcherMetrics = usePromiseWithSnackbarError(getLauncherMetrics, { + errorMessage: t("study.error.launchLoad"), + deps: [], + }); const applyFilter = useCallback( (taskList: TaskView[]) => { @@ -91,6 +89,8 @@ function JobTableView(props: PropType) { setCurrentContent(applyFilter(content)); }, [content, applyFilter]); + useInterval(launcherMetrics.reload, 5000); + return ( ( <> {t("study.allocatedCpuRate")} @@ -152,7 +153,6 @@ function JobTableView(props: PropType) { color="primary" onClick={() => { refresh(); - laucherMetrics.reload(); }} variant="outlined" >