Use AuthenticationSession.account.id to dedupe sessions (#152774)

`AuthenticationSession.account.label` is not guaranteed to be unique
This commit is contained in:
Joyce Er
2022-06-22 00:41:06 -07:00
committed by GitHub
parent d6e60d3051
commit 453ddc22f6

View File

@@ -211,7 +211,7 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
const sessions = await this.authenticationService.getSessions(authenticationProviderId, scopes) || [];
for (const session of sessions) {
const account: UserDataSyncAccount = new UserDataSyncAccount(authenticationProviderId, session);
accounts.set(account.accountName, account);
accounts.set(account.accountId, account);
if (this.isCurrentAccount(account)) {
currentAccount = account;
}
@@ -219,7 +219,7 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
if (currentAccount) {
// Always use current account if available
accounts.set(currentAccount.accountName, currentAccount);
accounts.set(currentAccount.accountId, currentAccount);
}
return [...accounts.values()];