Settings editor - avoid repeated extension list refresh (#303957)

settings: move refreshInstalledExtensionsList() outside loop
This commit is contained in:
xingsy97
2026-03-27 23:53:51 +08:00
committed by GitHub
parent 63304545b2
commit 9b0dd7c567

View File

@@ -1393,7 +1393,10 @@ export class SettingsEditor2 extends EditorPane {
const additionalGroups: ISettingsGroup[] = [];
let setAdditionalGroups = false;
const toggleData = await getExperimentalExtensionToggleData(this.chatEntitlementService, this.extensionGalleryService, this.productService);
if (toggleData && groups.filter(g => g.extensionInfo).length) {
if (toggleData && groups.filter(g => g.extensionInfo).length && Object.keys(toggleData.settingsEditorRecommendedExtensions).length) {
// Refresh installed extensions once per onConfigUpdate invocation for performance,
// instead of per extension. The installed list may still change while iterating.
await this.refreshInstalledExtensionsList();
for (const key in toggleData.settingsEditorRecommendedExtensions) {
const extension: IGalleryExtension = toggleData.recommendedExtensionsGalleryInfo[key];
if (!extension) {
@@ -1401,8 +1404,6 @@ export class SettingsEditor2 extends EditorPane {
}
const extensionId = extension.identifier.id;
// prevent race between extension update handler and this (onConfigUpdate) handler
await this.refreshInstalledExtensionsList();
const extensionInstalled = this.installedExtensionIds.includes(extensionId);
// Drill down to see whether the group and setting already exist