diff --git a/site/src/modules/templates/useWatchVersionLogs.ts b/site/src/modules/templates/useWatchVersionLogs.ts index 586499fb0c944..5574e083a9849 100644 --- a/site/src/modules/templates/useWatchVersionLogs.ts +++ b/site/src/modules/templates/useWatchVersionLogs.ts @@ -20,7 +20,10 @@ export const useWatchVersionLogs = ( return; } - if (templateVersionStatus !== "running") { + if ( + templateVersionStatus !== "running" && + templateVersionStatus !== "pending" + ) { return; } diff --git a/site/src/pages/TemplateVersionEditorPage/TemplateVersionEditorPage.test.tsx b/site/src/pages/TemplateVersionEditorPage/TemplateVersionEditorPage.test.tsx index 916184c2d4bbc..2cb97396a2f60 100644 --- a/site/src/pages/TemplateVersionEditorPage/TemplateVersionEditorPage.test.tsx +++ b/site/src/pages/TemplateVersionEditorPage/TemplateVersionEditorPage.test.tsx @@ -324,14 +324,13 @@ test("display pending badge and update it to running when status changes", async }, }; - let calls = 0; + let running = false; server.use( http.get( "/api/v2/organizations/:org/templates/:template/versions/:version", () => { - calls += 1; return HttpResponse.json( - calls > 1 ? MockRunningTemplateVersion : MockPendingTemplateVersion, + running ? MockRunningTemplateVersion : MockPendingTemplateVersion, ); }, ), @@ -348,6 +347,10 @@ test("display pending badge and update it to running when status changes", async const status = await screen.findByRole("status"); expect(status).toHaveTextContent("Pending"); + // Manually update the endpoint, as to not rely on the editor page + // making a specific number of requests. + running = true; + await waitFor( () => { expect(status).toHaveTextContent("Running");