diff --git a/src/background/main.background.ts b/src/background/main.background.ts index 45c5c0c562..f274035952 100644 --- a/src/background/main.background.ts +++ b/src/background/main.background.ts @@ -556,10 +556,6 @@ export default class MainBackground { } async logout(expired: boolean, userId?: string) { - if (!userId) { - userId = await this.stateService.getUserId(); - } - await this.eventService.uploadEvents(userId); await Promise.all([ @@ -577,7 +573,7 @@ export default class MainBackground { this.keyConnectorService.clear(), ]); - await this.stateService.clean(); + await this.stateService.clean({ userId: userId }); if (userId == null || userId === (await this.stateService.getUserId())) { this.searchService.clearIndex(); @@ -996,13 +992,14 @@ export default class MainBackground { } private async reloadProcess(): Promise { - const accounts = Object.keys(this.stateService.accounts.getValue()); - for (const userId of accounts) { - if (!(await this.vaultTimeoutService.isLocked(userId))) { - return; + const accounts = this.stateService.accounts.getValue(); + if (accounts != null) { + for (const userId of Object.keys(accounts)) { + if (!(await this.vaultTimeoutService.isLocked(userId))) { + return; + } } } - await this.systemService.startProcessReload(); } } diff --git a/src/popup/app.component.ts b/src/popup/app.component.ts index 38ea6d3e81..d018b2ca4d 100644 --- a/src/popup/app.component.ts +++ b/src/popup/app.component.ts @@ -75,8 +75,6 @@ export class AppComponent implements OnInit { }); } - await this.stateService.clean({ userId: msg.userId }); - if (this.stateService.activeAccount.getValue() == null) { this.router.navigate(["home"]); }