mirror of
https://github.com/bitwarden/browser
synced 2025-12-10 13:23:34 +00:00
[PM-18055] - sync list and item view after saving vault item (#13412)
* sync list and item view after saving vault item * sync folder on save * remove unused destroy ref
This commit is contained in:
@@ -28,7 +28,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic
|
||||
import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { SyncService } from "@bitwarden/common/platform/sync";
|
||||
import { CipherId } from "@bitwarden/common/types/guid";
|
||||
import { CipherId, UserId } from "@bitwarden/common/types/guid";
|
||||
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
||||
import { TotpService } from "@bitwarden/common/vault/abstractions/totp.service";
|
||||
import { CipherType } from "@bitwarden/common/vault/enums";
|
||||
@@ -90,6 +90,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
deleted = false;
|
||||
userHasPremiumAccess = false;
|
||||
activeFilter: VaultFilter = new VaultFilter();
|
||||
activeUserId: UserId;
|
||||
|
||||
private modal: ModalRef = null;
|
||||
private componentIsDestroyed$ = new Subject<boolean>();
|
||||
@@ -237,12 +238,12 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
}
|
||||
|
||||
const activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId));
|
||||
this.activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId));
|
||||
|
||||
this.cipherService
|
||||
.failedToDecryptCiphers$(activeUserId)
|
||||
.failedToDecryptCiphers$(this.activeUserId)
|
||||
.pipe(
|
||||
map((ciphers) => ciphers.filter((c) => !c.isDeleted)),
|
||||
map((ciphers) => ciphers?.filter((c) => !c.isDeleted) ?? []),
|
||||
filter((ciphers) => ciphers.length > 0),
|
||||
take(1),
|
||||
takeUntil(this.componentIsDestroyed$),
|
||||
@@ -494,8 +495,10 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
async savedCipher(cipher: CipherView) {
|
||||
this.cipherId = cipher.id;
|
||||
this.action = "view";
|
||||
this.go();
|
||||
await this.vaultItemsComponent.refresh();
|
||||
await this.cipherService.clearCache(this.activeUserId);
|
||||
await this.viewComponent.load();
|
||||
this.go();
|
||||
}
|
||||
|
||||
async deletedCipher(cipher: CipherView) {
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
OnInit,
|
||||
Output,
|
||||
} from "@angular/core";
|
||||
import { filter, firstValueFrom, map, Observable, Subject, takeUntil } from "rxjs";
|
||||
import { filter, firstValueFrom, map, Observable } from "rxjs";
|
||||
|
||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
|
||||
@@ -80,8 +80,6 @@ export class ViewComponent implements OnDestroy, OnInit {
|
||||
private previousCipherId: string;
|
||||
private passwordReprompted = false;
|
||||
|
||||
private destroyed$ = new Subject<void>();
|
||||
|
||||
get fido2CredentialCreationDateValue(): string {
|
||||
const dateCreated = this.i18nService.t("dateCreated");
|
||||
const creationDate = this.datePipe.transform(
|
||||
@@ -144,18 +142,14 @@ export class ViewComponent implements OnDestroy, OnInit {
|
||||
async load() {
|
||||
this.cleanUp();
|
||||
|
||||
const activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId));
|
||||
// Grab individual cipher from `cipherViews$` for the most up-to-date information
|
||||
this.cipherService
|
||||
.cipherViews$(activeUserId)
|
||||
.pipe(
|
||||
const activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId));
|
||||
this.cipher = await firstValueFrom(
|
||||
this.cipherService.cipherViews$(activeUserId).pipe(
|
||||
map((ciphers) => ciphers?.find((c) => c.id === this.cipherId)),
|
||||
filter((cipher) => !!cipher),
|
||||
takeUntil(this.destroyed$),
|
||||
)
|
||||
.subscribe((cipher) => {
|
||||
this.cipher = cipher;
|
||||
});
|
||||
),
|
||||
);
|
||||
|
||||
this.canAccessPremium = await firstValueFrom(
|
||||
this.billingAccountProfileStateService.hasPremiumFromAnySource$(activeUserId),
|
||||
@@ -528,7 +522,6 @@ export class ViewComponent implements OnDestroy, OnInit {
|
||||
this.showCardNumber = false;
|
||||
this.showCardCode = false;
|
||||
this.passwordReprompted = false;
|
||||
this.destroyed$.next();
|
||||
if (this.totpInterval) {
|
||||
clearInterval(this.totpInterval);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user