1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-23 22:36:32 +02:00

Mobile, Desktop: Fixes #13103: Fix error when saving in-editor rendering-related settings (#13105)

This commit is contained in:
Henry Heino
2025-09-08 02:56:01 -07:00
committed by GitHub
parent f1e42f3bac
commit b72c48c693
2 changed files with 14 additions and 2 deletions

View File

@@ -808,15 +808,20 @@ class Setting extends BaseModel {
this.scheduleChangeEvent();
};
const setValueInternalIfExists = <Key extends string> (key: Key, value: SettingValueType<Key>) => {
if (!this.keyExists(key)) return;
setValueInternal(key, value);
};
setValueInternal(key, value);
// Prevent conflicts. Use setValueInternal to avoid infinite recursion in the case
// where conflictingSettings has invalid data.
for (const conflict of conflictingSettings) {
if (conflict.key1 === key && conflict.value1 === value) {
setValueInternal(conflict.key2, conflict.alternate2);
setValueInternalIfExists(conflict.key2, conflict.alternate2);
} else if (conflict.key2 === key && conflict.value2 === value) {
setValueInternal(conflict.key1, conflict.alternate1);
setValueInternalIfExists(conflict.key1, conflict.alternate1);
}
}
}