From 96205bf6b8b6579a7b23638e559426f6c7f399ba Mon Sep 17 00:00:00 2001 From: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Date: Fri, 28 Oct 2022 07:41:10 +1000 Subject: [PATCH] Don't refresh org vault on filter change (#3879) --- .../src/app/organizations/vault/vault.component.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/web/src/app/organizations/vault/vault.component.ts b/apps/web/src/app/organizations/vault/vault.component.ts index 7de36e65318..8b6478fa35c 100644 --- a/apps/web/src/app/organizations/vault/vault.component.ts +++ b/apps/web/src/app/organizations/vault/vault.component.ts @@ -166,10 +166,16 @@ export class VaultComponent implements OnInit, OnDestroy { async applyVaultFilter(vaultFilter: VaultFilter) { this.ciphersComponent.showAddNew = vaultFilter.status !== "trash"; this.activeFilter = vaultFilter; - await this.ciphersComponent.reload( - this.activeFilter.buildFilter(), - vaultFilter.status === "trash" - ); + + // Hack to avoid calling cipherService.getAllFromApiForOrganization every time the vault filter changes. + // Call CiphersComponent.applyFilter directly instead of going through CiphersComponent.reload, which + // reloads all the ciphers unnecessarily. Will be fixed properly by EC-14. + this.ciphersComponent.loaded = false; + this.ciphersComponent.deleted = vaultFilter.status === "trash" || false; + await this.ciphersComponent.applyFilter(this.activeFilter.buildFilter()); + this.ciphersComponent.loaded = true; + // End hack + this.vaultFilterComponent.searchPlaceholder = this.vaultService.calculateSearchBarLocalizationString(this.activeFilter); this.go();