From 28346be0df6426aee4a9c99ee5f8eae6c7c25c94 Mon Sep 17 00:00:00 2001 From: Justin Baur <19896123+justindbaur@users.noreply.github.com> Date: Fri, 9 May 2025 16:21:47 -0400 Subject: [PATCH] [PM-21279] Cipher for url speedup (#14684) * Use `perUserCache$` for `getAllDecryptedForUrl` * Fix loads before first lock * Filter out null ciphers --- libs/common/src/vault/services/cipher.service.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libs/common/src/vault/services/cipher.service.ts b/libs/common/src/vault/services/cipher.service.ts index 21f268d84de..6685898b763 100644 --- a/libs/common/src/vault/services/cipher.service.ts +++ b/libs/common/src/vault/services/cipher.service.ts @@ -515,8 +515,15 @@ export class CipherService implements CipherServiceAbstraction { includeOtherTypes?: CipherType[], defaultMatch: UriMatchStrategySetting = null, ): Promise { - const ciphers = await this.getAllDecrypted(userId); - return await this.filterCiphersForUrl(ciphers, url, includeOtherTypes, defaultMatch); + return await firstValueFrom( + this.cipherViews$(userId).pipe( + filter((c) => c != null), + switchMap( + async (ciphers) => + await this.filterCiphersForUrl(ciphers, url, includeOtherTypes, defaultMatch), + ), + ), + ); } async filterCiphersForUrl(