some initial work on local only config

This commit is contained in:
Henry Jameson 2026-02-24 21:16:38 +02:00
commit bac19670f7
2 changed files with 47 additions and 13 deletions

View file

@ -47,6 +47,10 @@ export default {
type: Boolean,
default: false,
},
local: {
type: Boolean,
default: false,
},
parentPath: {
type: [String, Array],
},
@ -259,11 +263,17 @@ export default {
const writePath = `simple.${readPath}`
if (!this.timedApplyMode) {
useSyncConfigStore().setSimplePrefAndSave({
path: writePath,
value,
})
useSyncConfigStore().pushSyncConfig()
if (this.local) {
useLocalConfigStore().set({
path: writePath,
value,
})
} else {
useSyncConfigStore().setSimplePrefAndSave({
path: writePath,
value,
})
}
} else {
if (useInterfaceStore().temporaryChangesTimeoutId !== null) {
console.error("Can't track more than one temporary change")
@ -272,18 +282,30 @@ export default {
const oldValue = get(this.configSource, readPath)
useSyncConfigStore().setPreference({ path: writePath, value })
if (this.local) {
useLocalConfigStore().setTemporarily({ path: writePath, value })
} else {
useSyncConfigStore().setPreference({ path: writePath, value })
}
const confirm = () => {
useSyncConfigStore().pushSyncConfig()
if (this.local) {
useLocalConfigStore().set({ path: writePath, value })
} else {
useSyncConfigStore().pushSyncConfig()
}
useInterfaceStore().clearTemporaryChanges()
}
const revert = () => {
useSyncConfigStore().setPreference({
path: writePath,
value: oldValue,
})
if (this.local) {
useLocalConfigStore().unsetTemporarily({ path: writePath, value })
} else {
useSyncConfigStore().setPreference({
path: writePath,
value: oldValue,
})
}
useInterfaceStore().clearTemporaryChanges()
}