File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed
Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -44,8 +44,14 @@ export class SecretsManager {
4444 public async setCurrentDeployment (
4545 deployment : Deployment | undefined ,
4646 ) : Promise < void > {
47- const state = {
48- deployment : deployment ?? null ,
47+ const state : CurrentDeploymentState & { timestamp : string } = {
48+ // Extract the necessary fields before serializing
49+ deployment : deployment
50+ ? {
51+ url : deployment ?. url ,
52+ safeHostname : deployment ?. safeHostname ,
53+ }
54+ : null ,
4955 timestamp : new Date ( ) . toISOString ( ) ,
5056 } ;
5157 await this . secrets . store ( CURRENT_DEPLOYMENT_KEY , JSON . stringify ( state ) ) ;
@@ -132,7 +138,9 @@ export class SecretsManager {
132138 auth : SessionAuth ,
133139 ) : Promise < void > {
134140 const sessionKey = this . getSessionKey ( safeHostname ) ;
135- await this . secrets . store ( sessionKey , JSON . stringify ( auth ) ) ;
141+ // Extract only url and token before serializing
142+ const state : SessionAuth = { url : auth . url , token : auth . token } ;
143+ await this . secrets . store ( sessionKey , JSON . stringify ( state ) ) ;
136144 await this . recordDeploymentAccess ( safeHostname ) ;
137145 }
138146
Original file line number Diff line number Diff line change @@ -80,7 +80,6 @@ export class DeploymentManager implements vscode.Disposable {
8080 ) : Promise < void > {
8181 this . setDeployment ( deployment ) ;
8282
83- this . refreshWorkspaces ( ) ;
8483 await this . persistDeployment ( deployment ) ;
8584 }
8685
@@ -98,14 +97,15 @@ export class DeploymentManager implements vscode.Disposable {
9897 }
9998
10099 private setDeployment ( deployment : DeploymentWithAuth ) : void {
100+ this . currentDeployment = { ...deployment } ;
101101 if ( deployment . token === undefined ) {
102102 this . client . setHost ( deployment . url ) ;
103103 } else {
104104 this . client . setCredentials ( deployment . url , deployment . token ) ;
105105 }
106106 this . registerAuthListener ( deployment . safeHostname ) ;
107- this . currentDeployment = { ...deployment } ;
108107 this . updateAuthContexts ( deployment . user ) ;
108+ this . refreshWorkspaces ( ) ;
109109 }
110110
111111 /**
@@ -137,8 +137,8 @@ export class DeploymentManager implements vscode.Disposable {
137137 return ;
138138 }
139139
140- this . logger . info ( "Deployment changed from another window" ) ;
141140 if ( deployment ) {
141+ this . logger . info ( "Deployment changed from another window" ) ;
142142 const auth = await this . secretsManager . getSessionAuth (
143143 deployment . safeHostname ,
144144 ) ;
You can’t perform that action at this time.
0 commit comments