fix: don't show prebuild workspaces as tasks (#19572)

Fixes https://github.com/coder/coder/issues/19570

**Before:**

<img width="2776" height="1274" alt="image"
src="https://github.com/user-attachments/assets/bd260dbf-0868-4e4a-9997-b2fd3c99f33c"
/>

**After:**

<img width="1624" height="970" alt="Screenshot 2025-08-27 at 09 11 31"
src="https://github.com/user-attachments/assets/c85489d8-031c-4cbe-8298-6fee04e30b1f"
/>

**Things to notice:**
- There is a task without a prompt at the end, it should not happen
anymore
- There is no test for this because we mock the API function and the fix
was inside of it. It is a temp solution, the API should be ready to be
used by the FE soon
This commit is contained in:
Bruno Quaresma
2025-08-28 12:14:53 -03:00
committed by GitHub
parent 0ab345ca84
commit abc946c5bd
+7 -3
View File
@@ -2702,14 +2702,18 @@ class ExperimentalApiMethods {
queryExpressions.push(`owner:${filter.username}`);
}
const workspaces = await API.getWorkspaces({
const res = await API.getWorkspaces({
q: queryExpressions.join(" "),
});
// Exclude prebuild workspaces as they are not user-facing.
const workspaces = res.workspaces.filter(
(workspace) => !workspace.is_prebuild,
);
const prompts = await API.experimental.getAITasksPrompts(
workspaces.workspaces.map((workspace) => workspace.latest_build.id),
workspaces.map((workspace) => workspace.latest_build.id),
);
return workspaces.workspaces.map((workspace) => ({
return workspaces.map((workspace) => ({
workspace,
prompt: prompts.prompts[workspace.latest_build.id],
}));