1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-11 13:53:34 +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

@@ -1,6 +1,7 @@
import {
Component,
NgZone,
OnDestroy,
OnInit,
SecurityContext,
Type,
@@ -77,7 +78,7 @@ const systemTimeoutOptions = {
</div>
`,
})
export class AppComponent implements OnInit {
export class AppComponent implements OnInit, OnDestroy {
@ViewChild("settings", { read: ViewContainerRef, static: true }) settingsRef: ViewContainerRef;
@ViewChild("premium", { read: ViewContainerRef, static: true }) premiumRef: ViewContainerRef;
@ViewChild("passwordHistory", { read: ViewContainerRef, static: true })
@@ -129,7 +130,7 @@ export class AppComponent implements OnInit {
) {}
ngOnInit() {
this.stateService.activeAccount.pipe(takeUntil(this.destroy$)).subscribe((userId) => {
this.stateService.activeAccount$.pipe(takeUntil(this.destroy$)).subscribe((userId) => {
this.activeUserId = userId;
});