Skip to content

Commit f022aa4

Browse files
committed
fix state used for auth
1 parent 8679681 commit f022aa4

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "auth: remote workspaces use the global state, showing incorrect profile info"
4+
}

src/auth/auth.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -743,11 +743,21 @@ export class Auth implements AuthService, ConnectionManager {
743743

744744
static #instance: Auth | undefined
745745
public static get instance() {
746-
const devEnvId = getCodeCatalystDevEnvId()
747-
const memento =
748-
devEnvId !== undefined ? partition(globals.context.globalState, devEnvId) : globals.context.globalState
746+
return (this.#instance ??= new Auth(new ProfileStore(getMemento())))
749747

750-
return (this.#instance ??= new Auth(new ProfileStore(memento)))
748+
function getMemento() {
749+
if (!vscode.env.remoteName) {
750+
return globals.context.globalState
751+
}
752+
753+
const devEnvId = getCodeCatalystDevEnvId()
754+
755+
if (devEnvId !== undefined) {
756+
return partition(globals.context.globalState, devEnvId)
757+
}
758+
759+
return globals.context.workspaceState
760+
}
751761
}
752762

753763
private truncateStartUrl(startUrl: string) {

0 commit comments

Comments
 (0)