feat: select org profile on sign in (#8859)
* feat: select org profile on sign in * reset inside cascade init * reset only when personl
This commit is contained in:
@@ -100,7 +100,7 @@ export class ConfigHandler {
|
||||
return `${workspaceId}:::${orgId}`;
|
||||
}
|
||||
|
||||
private async cascadeInit(reason: string) {
|
||||
private async cascadeInit(reason: string, isLogin?: boolean) {
|
||||
const signal = this.cascadeAbortController.signal;
|
||||
this.workspaceDirs = null; // forces workspace dirs reload
|
||||
|
||||
@@ -118,7 +118,12 @@ export class ConfigHandler {
|
||||
const workspaceId = await this.getWorkspaceId();
|
||||
const selectedOrgs =
|
||||
this.globalContext.get("lastSelectedOrgIdForWorkspace") ?? {};
|
||||
const currentSelection = selectedOrgs[workspaceId];
|
||||
let currentSelection = selectedOrgs[workspaceId];
|
||||
|
||||
// reset personal org to first available non-personal org on login
|
||||
if (isLogin && currentSelection === "personal") {
|
||||
currentSelection = null;
|
||||
}
|
||||
|
||||
const firstNonPersonal = orgs.find(
|
||||
(org) => org.id !== this.PERSONAL_ORG_DESC.id,
|
||||
@@ -402,6 +407,7 @@ export class ConfigHandler {
|
||||
const newSession = sessionInfo;
|
||||
|
||||
let reload = false;
|
||||
let isLogin = false;
|
||||
if (newSession) {
|
||||
if (currentSession) {
|
||||
if (
|
||||
@@ -416,6 +422,7 @@ export class ConfigHandler {
|
||||
} else {
|
||||
// log in
|
||||
reload = true;
|
||||
isLogin = true;
|
||||
}
|
||||
} else {
|
||||
if (currentSession) {
|
||||
@@ -430,7 +437,7 @@ export class ConfigHandler {
|
||||
this.ide,
|
||||
);
|
||||
this.abortCascade();
|
||||
await this.cascadeInit("Control plane session info update");
|
||||
await this.cascadeInit("Control plane session info update", isLogin);
|
||||
}
|
||||
return reload;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user