1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-10 13:23:34 +00:00

[PM-6853] Stop Caching Empty Ciphers List (#8406)

* Stop Caching Empty Ciphers List

* Allow Caching `null`

* Move Logic to CipherService
This commit is contained in:
Justin Baur
2024-03-20 14:10:09 -05:00
committed by GitHub
parent 7b40c21798
commit 1400ec9c16

View File

@@ -79,7 +79,12 @@ export class CipherService implements CipherServiceAbstraction {
}
async setDecryptedCipherCache(value: CipherView[]) {
await this.stateService.setDecryptedCiphers(value);
// Sometimes we might prematurely decrypt the vault and that will result in no ciphers
// if we cache it then we may accidentially return it when it's not right, we'd rather try decryption again.
// We still want to set null though, that is the indicator that the cache isn't valid and we should do decryption.
if (value == null || value.length !== 0) {
await this.stateService.setDecryptedCiphers(value);
}
if (this.searchService != null) {
if (value == null) {
this.searchService.clearIndex();