Skip to content

Commit 9d4274e

Browse files
Remove session if it is being replaced (microsoft#212504)
A bug that has probably existed for quite a while... if we are replacing a session, we should say the old session is removed.
1 parent bbc0159 commit 9d4274e

File tree

1 file changed

+3
-2
lines changed
  • extensions/github-authentication/src

1 file changed

+3
-2
lines changed

extensions/github-authentication/src/github.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,14 +306,15 @@ export class GitHubAuthenticationProvider implements vscode.AuthenticationProvid
306306
this.afterSessionLoad(session);
307307

308308
const sessionIndex = sessions.findIndex(s => s.id === session.id || arrayEquals([...s.scopes].sort(), sortedScopes));
309+
const removed = new Array<vscode.AuthenticationSession>();
309310
if (sessionIndex > -1) {
310-
sessions.splice(sessionIndex, 1, session);
311+
removed.push(...sessions.splice(sessionIndex, 1, session));
311312
} else {
312313
sessions.push(session);
313314
}
314315
await this.storeSessions(sessions);
315316

316-
this._sessionChangeEmitter.fire({ added: [session], removed: [], changed: [] });
317+
this._sessionChangeEmitter.fire({ added: [session], removed, changed: [] });
317318

318319
this._logger.info('Login success!');
319320

0 commit comments

Comments
 (0)