From dccd54a724937ceb68004270d4a3b8fcf1f35d5b Mon Sep 17 00:00:00 2001 From: BrunoQuaresma Date: Mon, 28 Apr 2025 17:05:34 +0000 Subject: [PATCH] fix: fix script timings spam in the workspace UI --- site/src/pages/WorkspacePage/WorkspaceReadyPage.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/site/src/pages/WorkspacePage/WorkspaceReadyPage.tsx b/site/src/pages/WorkspacePage/WorkspaceReadyPage.tsx index e4329ecad78aa..ca5af8458d7e8 100644 --- a/site/src/pages/WorkspacePage/WorkspaceReadyPage.tsx +++ b/site/src/pages/WorkspacePage/WorkspaceReadyPage.tsx @@ -166,13 +166,15 @@ export const WorkspaceReadyPage: FC = ({ // Sometimes, the timings can be fetched before the agent script timings are // done or saved in the database so we need to conditionally refetch the // timings. To refetch the timings, I found the best way was to compare the - // expected amount of script timings with the current amount of script - // timings returned in the response. + // expected amount of script timings that run on start, with the current + // amount of script timings returned in the response. refetchInterval: (data) => { const expectedScriptTimingsCount = workspace.latest_build.resources .flatMap((r) => r.agents) - .flatMap((a) => a?.scripts ?? []).length; + .flatMap((a) => a?.scripts ?? []) + .filter((script) => script.run_on_start).length; const currentScriptTimingsCount = data?.agent_script_timings?.length ?? 0; + return expectedScriptTimingsCount === currentScriptTimingsCount ? false : 1_000;