Skip to content

Commit ce63f79

Browse files
committed
avoid resetting container in recreate
1 parent 410241d commit ce63f79

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

agent/agentcontainers/api.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,14 @@ func (api *API) handleDevcontainerRecreate(w http.ResponseWriter, r *http.Reques
511511
slog.F("name", api.knownDevcontainers[i].Name),
512512
)
513513
api.knownDevcontainers[i].Dirty = false
514-
api.knownDevcontainers[i].Container = nil
514+
// This is a bit of a hack since we don't know if we're
515+
// referencing the new or the old container. But this issue
516+
// will be cleared up the next time we call getContainers.
517+
// TODO(mafredri): This should be handled by a service that
518+
// updates the devcontainer state periodically and on-demand.
519+
if api.knownDevcontainers[i].Container != nil {
520+
api.knownDevcontainers[i].Container.DevcontainerDirty = false
521+
}
515522
}
516523
return
517524
}
@@ -584,6 +591,9 @@ func (api *API) markDevcontainerDirty(configPath string, modifiedAt time.Time) {
584591
if api.knownDevcontainers[i].Container != nil {
585592
api.knownDevcontainers[i].Container.DevcontainerDirty = true
586593
}
594+
// Set the modified time to the zero value to indicate that the
595+
// containers list must be refreshed.
596+
api.mtime = time.Time{}
587597
}
588598
}
589599
})

0 commit comments

Comments
 (0)