From b7192e5b99ad2a207f264fbcf6c5659dc60839b4 Mon Sep 17 00:00:00 2001 From: alishakawaguchi Date: Thu, 2 Nov 2023 16:11:20 -0700 Subject: [PATCH] fix job overview page polling every second (#489) --- frontend/app/jobs/[id]/components/RecentRuns.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/app/jobs/[id]/components/RecentRuns.tsx b/frontend/app/jobs/[id]/components/RecentRuns.tsx index 5930a40dcd..2394c96778 100644 --- a/frontend/app/jobs/[id]/components/RecentRuns.tsx +++ b/frontend/app/jobs/[id]/components/RecentRuns.tsx @@ -41,11 +41,13 @@ export default function JobRecentRuns({ jobId }: Props): ReactElement { } useEffect(() => { - const interval = setInterval(() => { + // Set a timeout to refresh once after 3 second + // used to show new runs after trigger + const timeoutId = setTimeout(() => { onRefreshClick(); - }, 1000); - return () => clearInterval(interval); - }, [jobId]); + }, 3000); + return () => clearTimeout(timeoutId); + }, []); const jobRunsIdMap = jobRuns?.jobRuns.reduce(