From 64531377b335cff1678335e422aa2cc778cb26c7 Mon Sep 17 00:00:00 2001 From: Maxim Hayes Date: Wed, 8 Jan 2025 12:04:28 -0500 Subject: [PATCH] fix(dev): Q developer menu opening wrong auth state It's opening the toolkit global state value instead. --- packages/core/src/dev/activation.ts | 2 +- packages/core/src/shared/utilities/mementos.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/core/src/dev/activation.ts b/packages/core/src/dev/activation.ts index b4100b191ce..41af4d2d5fb 100644 --- a/packages/core/src/dev/activation.ts +++ b/packages/core/src/dev/activation.ts @@ -334,7 +334,7 @@ class ObjectEditor { return this.openState(targetContext.secrets, key) case 'auth': // Auth memento is determined in a different way - return this.openState(getEnvironmentSpecificMemento(), key) + return this.openState(getEnvironmentSpecificMemento(globalState), key) } } diff --git a/packages/core/src/shared/utilities/mementos.ts b/packages/core/src/shared/utilities/mementos.ts index 88814414046..0e5e6a27618 100644 --- a/packages/core/src/shared/utilities/mementos.ts +++ b/packages/core/src/shared/utilities/mementos.ts @@ -37,19 +37,19 @@ export function partition(memento: vscode.Memento, key: string): vscode.Memento * with the local globalState. We want certain functionality to be isolated to * the remote instance. */ -export function getEnvironmentSpecificMemento(): vscode.Memento { +export function getEnvironmentSpecificMemento(globalState?: vscode.Memento): vscode.Memento { if (!vscode.env.remoteName) { // local compute: no further partitioning - return globals.globalState + return globalState ?? globals.globalState } const devEnvId = getCodeCatalystDevEnvId() if (devEnvId !== undefined) { // dev env: partition to dev env ID (compute backend might not always be the same) - return partition(globals.globalState, devEnvId) + return partition(globalState ?? globals.globalState, devEnvId) } // remote env: keeps a shared "global state" for all workspaces that report the same machine ID - return partition(globals.globalState, globals.machineId) + return partition(globalState ?? globals.globalState, globals.machineId) }