Skip to content

Commit dccd54a

Browse files
committed
fix: fix script timings spam in the workspace UI
1 parent 3ab3ef8 commit dccd54a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

site/src/pages/WorkspacePage/WorkspaceReadyPage.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,15 @@ export const WorkspaceReadyPage: FC<WorkspaceReadyPageProps> = ({
166166
// Sometimes, the timings can be fetched before the agent script timings are
167167
// done or saved in the database so we need to conditionally refetch the
168168
// timings. To refetch the timings, I found the best way was to compare the
169-
// expected amount of script timings with the current amount of script
170-
// timings returned in the response.
169+
// expected amount of script timings that run on start, with the current
170+
// amount of script timings returned in the response.
171171
refetchInterval: (data) => {
172172
const expectedScriptTimingsCount = workspace.latest_build.resources
173173
.flatMap((r) => r.agents)
174-
.flatMap((a) => a?.scripts ?? []).length;
174+
.flatMap((a) => a?.scripts ?? [])
175+
.filter((script) => script.run_on_start).length;
175176
const currentScriptTimingsCount = data?.agent_script_timings?.length ?? 0;
177+
176178
return expectedScriptTimingsCount === currentScriptTimingsCount
177179
? false
178180
: 1_000;

0 commit comments

Comments
 (0)