@@ -100,7 +100,7 @@ export class ConfigHandler {
100100 return `${ workspaceId } :::${ orgId } ` ;
101101 }
102102
103- private async cascadeInit ( reason : string ) {
103+ private async cascadeInit ( reason : string , isLogin ?: boolean ) {
104104 const signal = this . cascadeAbortController . signal ;
105105 this . workspaceDirs = null ; // forces workspace dirs reload
106106
@@ -118,7 +118,12 @@ export class ConfigHandler {
118118 const workspaceId = await this . getWorkspaceId ( ) ;
119119 const selectedOrgs =
120120 this . globalContext . get ( "lastSelectedOrgIdForWorkspace" ) ?? { } ;
121- const currentSelection = selectedOrgs [ workspaceId ] ;
121+ let currentSelection = selectedOrgs [ workspaceId ] ;
122+
123+ // reset personal org to first available non-personal org on login
124+ if ( isLogin && currentSelection === "personal" ) {
125+ currentSelection = null ;
126+ }
122127
123128 const firstNonPersonal = orgs . find (
124129 ( org ) => org . id !== this . PERSONAL_ORG_DESC . id ,
@@ -402,6 +407,7 @@ export class ConfigHandler {
402407 const newSession = sessionInfo ;
403408
404409 let reload = false ;
410+ let isLogin = false ;
405411 if ( newSession ) {
406412 if ( currentSession ) {
407413 if (
@@ -416,6 +422,7 @@ export class ConfigHandler {
416422 } else {
417423 // log in
418424 reload = true ;
425+ isLogin = true ;
419426 }
420427 } else {
421428 if ( currentSession ) {
@@ -430,7 +437,7 @@ export class ConfigHandler {
430437 this . ide ,
431438 ) ;
432439 this . abortCascade ( ) ;
433- await this . cascadeInit ( "Control plane session info update" ) ;
440+ await this . cascadeInit ( "Control plane session info update" , isLogin ) ;
434441 }
435442 return reload ;
436443 }
0 commit comments