1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-20 10:13:31 +00:00

Fix active account and searchBar observables/subscriptions (#3268)

* Change subscription to rely on observables and not on BehaviourSubject

* Ensure OnDestroy is added to AppComponent

* Fix check for no active accounts to redirect to the login page instead of lock

* Change subscription handling on SearchBarService

* Fix naming convention: Observables should have a $ suffix

* Remove obsolete linter hint

* Fix activeAccountUnlocked getting exposed as Observable but is instantiated as BehaviourSubject
This commit is contained in:
Daniel James Smith
2022-08-09 21:11:51 +02:00
committed by GitHub
parent c4f9c2cca6
commit cfc8858ef9
13 changed files with 52 additions and 37 deletions

View File

@@ -56,7 +56,7 @@ export class AppComponent implements OnInit, OnDestroy {
// Clear them aggressively to make sure this doesn't occur
await this.clearComponentStates();
this.stateService.activeAccount.pipe(takeUntil(this.destroy$)).subscribe((userId) => {
this.stateService.activeAccount$.pipe(takeUntil(this.destroy$)).subscribe((userId) => {
this.activeUserId = userId;
});
@@ -84,7 +84,7 @@ export class AppComponent implements OnInit, OnDestroy {
});
}
if (this.stateService.activeAccount.getValue() == null) {
if (this.activeUserId === null) {
this.router.navigate(["home"]);
}
});