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:
@@ -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> {
|
||||
|
||||
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user