Skip to content

Commit 1270f18

Browse files
committed
Simplify and comment select agent
1 parent 6ae6efe commit 1270f18

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

site/src/pages/WorkspacesPage/WorkspacesTable.tsx

+12-7
Original file line numberDiff line numberDiff line change
@@ -641,14 +641,19 @@ const WorkspaceApps: FC<WorkspaceAppsProps> = ({ workspace }) => {
641641
const { data: apiKeyRes } = useQuery(apiKey());
642642
const token = apiKeyRes?.key;
643643

644-
const resource = workspace.latest_build.resources
644+
/**
645+
* Coder is pretty flexible and allows an enormous variety of use cases, such
646+
* as having multiple resources with many agents, but they are not common. The
647+
* most common scenario is to have one single compute resource with one single
648+
* agent containing all the apps. Lets test this getting the apps for the
649+
* first resource, and first agent - they are sorted to return the compute
650+
* resource first - and see what customers and ourselves, using dogfood, think
651+
* about that.
652+
*/
653+
const agent = workspace.latest_build.resources
645654
.filter((r) => !r.hide)
646-
.at(0);
647-
if (!resource) {
648-
return null;
649-
}
650-
651-
const agent = resource.agents?.at(0);
655+
.at(0)
656+
?.agents?.at(0);
652657
if (!agent) {
653658
return null;
654659
}

0 commit comments

Comments
 (0)