Improve troubleshooting and compatible setting handling

This commit is contained in:
vorotamoroz
2026-07-24 08:51:30 +00:00
parent 058da1f34c
commit d489452583
15 changed files with 868 additions and 50 deletions
@@ -206,7 +206,8 @@ export class LiveSyncSetting extends Setting {
const setValue = wrapMemo((value: boolean) => {
toggle.setValue(opt?.invert ? !value : value);
});
this.invalidateValue = () => setValue(LiveSyncSetting.env.editingSettings[key] ?? false);
this.invalidateValue = () =>
setValue(LiveSyncSetting.env.editingSettings[key] ?? opt?.defaultToggleValue ?? false);
this.invalidateValue();
toggle.onChange(async (value) => {
@@ -35,7 +35,9 @@ export function paneAdvanced(this: ObsidianLiveSyncSettingTab, paneEl: HTMLEleme
clampMin: 10,
onUpdate: this.onlyOnCouchDB,
});
new Setting(paneEl).setClass("wizardHidden").autoWireToggle("autoAcceptCompatibleTweak");
new Setting(paneEl)
.setClass("wizardHidden")
.autoWireToggle("autoAcceptCompatibleTweak", { defaultToggleValue: true });
// new Setting(paneEl)
// .setClass("wizardHidden")
// .autoWireToggle("sendChunksBulk", { onUpdate: onlyOnCouchDB })
@@ -75,6 +75,7 @@ export type AutoWireOption = {
holdValue?: boolean;
isPassword?: boolean;
invert?: boolean;
defaultToggleValue?: boolean;
onUpdate?: OnUpdateFunc;
obsolete?: boolean;
};