mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 14:23:32 +00:00
[PM-14039] - [Defect] Desktop vault changes aren't immediately taking effect (#13186)
* favor subscription over firstValueFrom in desktop cipher view
* add event handling for username generator
* Revert "add event handling for username generator"
This reverts commit 73cffbcc6b.
* close out subscription on cleanup
This commit is contained in:
@@ -11,7 +11,7 @@ import {
|
|||||||
OnInit,
|
OnInit,
|
||||||
Output,
|
Output,
|
||||||
} from "@angular/core";
|
} from "@angular/core";
|
||||||
import { filter, firstValueFrom, map, Observable } from "rxjs";
|
import { filter, firstValueFrom, map, Observable, Subject, takeUntil } from "rxjs";
|
||||||
|
|
||||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||||
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
|
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
|
||||||
@@ -81,6 +81,7 @@ export class ViewComponent implements OnDestroy, OnInit {
|
|||||||
private passwordReprompted = false;
|
private passwordReprompted = false;
|
||||||
|
|
||||||
private activeUserId$ = this.accountService.activeAccount$.pipe(map((a) => a?.id));
|
private activeUserId$ = this.accountService.activeAccount$.pipe(map((a) => a?.id));
|
||||||
|
private destroyed$ = new Subject<void>();
|
||||||
|
|
||||||
get fido2CredentialCreationDateValue(): string {
|
get fido2CredentialCreationDateValue(): string {
|
||||||
const dateCreated = this.i18nService.t("dateCreated");
|
const dateCreated = this.i18nService.t("dateCreated");
|
||||||
@@ -146,12 +147,15 @@ export class ViewComponent implements OnDestroy, OnInit {
|
|||||||
|
|
||||||
const activeUserId = await firstValueFrom(this.activeUserId$);
|
const activeUserId = await firstValueFrom(this.activeUserId$);
|
||||||
// Grab individual cipher from `cipherViews$` for the most up-to-date information
|
// Grab individual cipher from `cipherViews$` for the most up-to-date information
|
||||||
this.cipher = await firstValueFrom(
|
this.cipherService.cipherViews$
|
||||||
this.cipherService.cipherViews$.pipe(
|
.pipe(
|
||||||
map((ciphers) => ciphers.find((c) => c.id === this.cipherId)),
|
map((ciphers) => ciphers?.find((c) => c.id === this.cipherId)),
|
||||||
filter((cipher) => !!cipher),
|
filter((cipher) => !!cipher),
|
||||||
),
|
takeUntil(this.destroyed$),
|
||||||
);
|
)
|
||||||
|
.subscribe((cipher) => {
|
||||||
|
this.cipher = cipher;
|
||||||
|
});
|
||||||
|
|
||||||
this.canAccessPremium = await firstValueFrom(
|
this.canAccessPremium = await firstValueFrom(
|
||||||
this.billingAccountProfileStateService.hasPremiumFromAnySource$(activeUserId),
|
this.billingAccountProfileStateService.hasPremiumFromAnySource$(activeUserId),
|
||||||
@@ -524,6 +528,7 @@ export class ViewComponent implements OnDestroy, OnInit {
|
|||||||
this.showCardNumber = false;
|
this.showCardNumber = false;
|
||||||
this.showCardCode = false;
|
this.showCardCode = false;
|
||||||
this.passwordReprompted = false;
|
this.passwordReprompted = false;
|
||||||
|
this.destroyed$.next();
|
||||||
if (this.totpInterval) {
|
if (this.totpInterval) {
|
||||||
clearInterval(this.totpInterval);
|
clearInterval(this.totpInterval);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user