diff --git a/src/app/layout/account-switcher.component.html b/src/app/layout/account-switcher.component.html
index 2882504644..5a89046733 100644
--- a/src/app/layout/account-switcher.component.html
+++ b/src/app/layout/account-switcher.component.html
@@ -27,7 +27,7 @@
[cdkConnectedOverlayHasBackdrop]="true"
[cdkConnectedOverlayBackdropClass]="'cdk-overlay-transparent-backdrop'"
(backdropClick)="toggle()"
- [cdkConnectedOverlayOpen]="isOpen"
+ [cdkConnectedOverlayOpen]="showSwitcher && isOpen"
cdkConnectedOverlayMinWidth="250px"
>
diff --git a/src/app/layout/account-switcher.component.ts b/src/app/layout/account-switcher.component.ts
index c650a7d34b..88e810f27c 100644
--- a/src/app/layout/account-switcher.component.ts
+++ b/src/app/layout/account-switcher.component.ts
@@ -7,6 +7,7 @@ import { StateService } from "jslib-common/abstractions/state.service";
import { VaultTimeoutService } from "jslib-common/abstractions/vaultTimeout.service";
import { AuthenticationStatus } from "jslib-common/enums/authenticationStatus";
+import { Utils } from "jslib-common/misc/utils";
import { Account } from "jslib-common/models/domain/account";
@@ -56,7 +57,7 @@ export class AccountSwitcherComponent implements OnInit {
serverUrl: string;
get showSwitcher() {
- return this.accounts != null && Object.keys(this.accounts).length > 0;
+ return !Utils.isNullOrWhitespace(this.activeAccountEmail);
}
constructor(
@@ -91,9 +92,6 @@ export class AccountSwitcherComponent implements OnInit {
async switch(userId: string) {
this.toggle();
- if (userId === (await this.stateService.getUserId())) {
- return;
- }
this.messagingService.send("switchAccount", { userId: userId });
}
@@ -102,9 +100,10 @@ export class AccountSwitcherComponent implements OnInit {
}): Promise<{ [userId: string]: SwitcherAccount }> {
const switcherAccounts: { [userId: string]: SwitcherAccount } = {};
for (const userId in baseAccounts) {
- if (userId == null) {
+ if (userId == null || userId === (await this.stateService.getUserId())) {
continue;
}
+
// environmentUrls are stored on disk and must be retrieved seperatly from the in memory state offered from subscribing to accounts
baseAccounts[userId].settings.environmentUrls = await this.stateService.getEnvironmentUrls({
userId: userId,