1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

[Bug] [Account Switching] Improve State Management Performance (#1237)

* [dep] Implement new StateService factory parameter from jslib

* [bug] Ensure setLastActive uses the correct userId

Sometimes, because of how often it fires, setLastActive can cause accounts to override each other. To make sure the correct userId is always used we now subscribe to activeUser in the appComponent and pass that value into any setLastActive calls.

* [bug] Show loader when logging out

When logging out of a large vault the application can appear to hang. This commit turns on the app component loader while logout is doing work.

* [bug] Stop tracking activity without an active user

* [style] Ran prettier

* [chore] Update jslib
This commit is contained in:
Addison Beck
2022-01-19 11:00:28 -05:00
committed by GitHub
parent 8b521aa35e
commit b796fe094f
4 changed files with 41 additions and 9 deletions

View File

@@ -22,6 +22,8 @@ import { NativeMessagingMain } from "./main/nativeMessaging.main";
import { StateService } from "jslib-common/services/state.service";
import { Account, AccountFactory } from "jslib-common/models/domain/account";
export class Main {
logService: ElectronLogService;
i18nService: I18nService;
@@ -79,7 +81,13 @@ export class Main {
// TODO: this state service will have access to on disk storage, but not in memory storage.
// If we could get this to work using the stateService singleton that the rest of the app uses we could save
// ourselves from some hacks, like having to manually update the app menu vs. the menu subscribing to events.
this.stateService = new StateService(this.storageService, null, this.logService, null);
this.stateService = new StateService(
this.storageService,
null,
this.logService,
null,
new AccountFactory(Account)
);
this.windowMain = new WindowMain(
this.stateService,