Skip to content

Commit 18e1593

Browse files
committed
ui-final?
1 parent 2c2bf28 commit 18e1593

File tree

5 files changed

+133
-336
lines changed

5 files changed

+133
-336
lines changed

agent/agentcontainers/api.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -661,13 +661,17 @@ func (api *API) getContainers() (codersdk.WorkspaceAgentListContainersResponse,
661661
if len(api.knownDevcontainers) > 0 {
662662
devcontainers = make([]codersdk.WorkspaceAgentDevcontainer, 0, len(api.knownDevcontainers))
663663
for _, dc := range api.knownDevcontainers {
664-
// Include the agent if it's been created (we're iterating
665-
// over copies, so mutating is fine).
666-
if agent := api.injectedSubAgentProcs[dc.WorkspaceFolder].agent; agent.ID != uuid.Nil {
664+
// Include the agent if it's been created (we're iterating over
665+
// copies, so mutating is fine).
666+
//
667+
// NOTE(mafredri): We could filter on "proc.containerID == dc.Container.ID"
668+
// here but not doing so allows us to do some tricks in the UI to
669+
// make the experience more responsive for now.
670+
if proc := api.injectedSubAgentProcs[dc.WorkspaceFolder]; proc.agent.ID != uuid.Nil {
667671
dc.Agent = &codersdk.WorkspaceAgentDevcontainerAgent{
668-
ID: agent.ID,
669-
Name: agent.Name,
670-
Directory: agent.Directory,
672+
ID: proc.agent.ID,
673+
Name: proc.agent.Name,
674+
Directory: proc.agent.Directory,
671675
}
672676
}
673677

0 commit comments

Comments
 (0)