From 7b831f42516a1a415a51c93df289daf67d421f47 Mon Sep 17 00:00:00 2001 From: alexyaang <59073590+alexyaang@users.noreply.github.com> Date: Wed, 20 Sep 2023 11:05:58 -0400 Subject: [PATCH] remove generic v2 root if it's the last one --- package-lock.json | 2 +- .../registries/genericV2/removeTrackedGenericV2Registry.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 016de2e6b5..5e1d9be9e0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -815,7 +815,7 @@ "node_modules/@microsoft/vscode-docker-registries": { "version": "0.1.0", "resolved": "file:../vscode-docker-extensibility/packages/vscode-docker-registries/microsoft-vscode-docker-registries-0.1.0.tgz", - "integrity": "sha512-af963bHhdUX51Rn3rSGSRD1qO/qeUxcoRbTzvA/c8R9GJdDqtRzgyaOu57ETzHyG/fUfd4qaDCMs2FNI9HNk5g==", + "integrity": "sha512-MryHAYc4dfe9DoYZ6XWA3J7aP2KsZLsnVrYwsTAQR8vtUUGH98LDAmb5ZH/9f1d67FgSQhP3GUfj6eTioQjjnA==", "license": "See LICENSE in the project root for license information.", "dependencies": { "dayjs": "^1.11.7", diff --git a/src/commands/registries/genericV2/removeTrackedGenericV2Registry.ts b/src/commands/registries/genericV2/removeTrackedGenericV2Registry.ts index 9c9815b3a5..93dbe84464 100644 --- a/src/commands/registries/genericV2/removeTrackedGenericV2Registry.ts +++ b/src/commands/registries/genericV2/removeTrackedGenericV2Registry.ts @@ -18,6 +18,12 @@ export async function removeTrackedGenericV2Registry(context: IActionContext, no } await ext.genericRegistryV2DataProvider.removeTrackedRegistry(node.wrappedItem); + + // remove the provider if it's the last one + if ((await ext.genericRegistryV2DataProvider.getRegistries(node.parent.wrappedItem)).length === 0) { + await ext.registriesTree.disconnectRegistryProvider(node.parent); + } + // don't wait void ext.registriesTree.refresh(); }