1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-16 16:59:30 +00:00

perf: reduce IO by removing unnecessary writes

This commit is contained in:
tangowithfoxtrot
2025-02-05 08:36:51 -08:00
parent e34467232c
commit 766a4725f4
2 changed files with 14 additions and 2 deletions

View File

@@ -76,7 +76,11 @@ export class KeyConnectorService implements KeyConnectorServiceAbstraction {
}
async setUsesKeyConnector(usesKeyConnector: boolean, userId: UserId) {
await this.stateProvider.getUser(userId, USES_KEY_CONNECTOR).update(() => usesKeyConnector);
await this.stateProvider.getUser(userId, USES_KEY_CONNECTOR).update(() => usesKeyConnector, {
shouldUpdate: (previous) => {
return previous === usesKeyConnector;
},
});
}
getUsesKeyConnector(userId: UserId): Promise<boolean> {

View File

@@ -155,7 +155,15 @@ export class DefaultDomainSettingsService implements DomainSettingsService {
}
async setEquivalentDomains(newValue: EquivalentDomains, userId: UserId): Promise<void> {
await this.stateProvider.getUser(userId, EQUIVALENT_DOMAINS).update(() => newValue);
await this.stateProvider.getUser(userId, EQUIVALENT_DOMAINS).update(() => newValue, {
shouldUpdate: (previous) => {
if (newValue.length === 0 && previous.length === 0) {
return false;
} else {
return true;
}
},
});
}
async setDefaultUriMatchStrategy(newValue: UriMatchStrategySetting): Promise<void> {