Skip to content

Commit 15a7ee0

Browse files
authored
Merge pull request #38 from feloy/fix/onDid-listContainers
fix: call loadContainers when needed
2 parents 57629c6 + 5fe4f35 commit 15a7ee0

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

packages/backend/src/managers/services.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,21 @@ export class ServicesManager {
7373
}
7474
});
7575
this.extensionContext.subscriptions.push(disposable);
76+
podmanDesktopApi.provider.onDidRegisterContainerConnection(async () => {
77+
this.loadContainers(undefined).catch((err: unknown) => {
78+
console.debug('initial load containers', err);
79+
});
80+
});
81+
podmanDesktopApi.provider.onDidUnregisterContainerConnection(async () => {
82+
this.loadContainers(undefined).catch((err: unknown) => {
83+
console.debug('initial load containers', err);
84+
});
85+
});
7686
podmanDesktopApi.provider.onDidUpdateContainerConnection(async e => {
77-
if (e.status === 'started') {
78-
// remove timeout when https://github.com/podman-desktop/podman-desktop/issues/10319 is fixed
79-
setTimeout(() => {
80-
this.loadContainers(undefined).catch((err: unknown) => {
81-
console.debug('initial load containers', err);
82-
});
83-
}, 5_000);
87+
if (e.status === 'started' || e.status === 'stopped') {
88+
this.loadContainers(undefined).catch((err: unknown) => {
89+
console.debug('initial load containers', err);
90+
});
8491
}
8592
});
8693
try {

0 commit comments

Comments
 (0)