Skip to content

Commit

Permalink
recovery fix for #232516 (#233293)
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 authored Nov 7, 2024
1 parent 7d80f16 commit e865366
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { ISecretStorageService } from '../../../../platform/secrets/common/secre
import { IFileService } from '../../../../platform/files/common/files.js';
import { escapeRegExpCharacters } from '../../../../base/common/strings.js';
import { IUserDataSyncMachinesService } from '../../../../platform/userDataSync/common/userDataSyncMachines.js';
import { equals } from '../../../../base/common/arrays.js';

type AccountQuickPickItem = { label: string; authenticationProvider: IAuthenticationProvider; account?: UserDataSyncAccount; description?: string };

Expand Down Expand Up @@ -142,8 +143,12 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
}
}

private updateAuthenticationProviders(): void {
private updateAuthenticationProviders(): boolean {
this.logService.info('Settings Sync: Updating authentication providers. Authentication Providers from store:', this.userDataSyncStoreManagementService.userDataSyncStore?.authenticationProviders || [].map(({ id }) => id));
const oldValue = this._authenticationProviders;
this._authenticationProviders = (this.userDataSyncStoreManagementService.userDataSyncStore?.authenticationProviders || []).filter(({ id }) => this.authenticationService.declaredProviders.some(provider => provider.id === id));
this.logService.info('Settings Sync: Authentication providers updated', this._authenticationProviders.map(({ id }) => id));
return equals(oldValue, this._authenticationProviders, (a, b) => a.id === b.id);
}

private isSupportedAuthenticationProviderId(authenticationProviderId: string): boolean {
Expand Down Expand Up @@ -183,7 +188,11 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat

await this.update();

this._register(this.authenticationService.onDidChangeDeclaredProviders(() => this.updateAuthenticationProviders()));
this._register(this.authenticationService.onDidChangeDeclaredProviders(() => {
if (this.updateAuthenticationProviders()) {
this.update('declared authentication providers changed');
}
}));

this._register(Event.filter(
Event.any(
Expand Down

0 comments on commit e865366

Please sign in to comment.