proper temporary setting + fix appearance stuff using stale data

This commit is contained in:
Henry Jameson 2026-01-23 14:53:22 +02:00
commit ae17911560
2 changed files with 9 additions and 8 deletions

View file

@ -251,11 +251,11 @@ export default {
return (k, v) => return (k, v) =>
this.$store.dispatch('pushAdminSetting', { path: k, value: v }) this.$store.dispatch('pushAdminSetting', { path: k, value: v })
default: default:
return (originalPath, value) => { return (readPath, value) => {
const path = `simple.${originalPath}` const writePath = `simple.${readPath}`
if (!this.timedApplyMode) { if (!this.timedApplyMode) {
useSyncConfigStore().setPreference({ path, value }) useSyncConfigStore().setPreference({ path: writePath, value })
useSyncConfigStore().pushSyncConfig() useSyncConfigStore().pushSyncConfig()
} else { } else {
if (useInterfaceStore().temporaryChangesTimeoutId !== null) { if (useInterfaceStore().temporaryChangesTimeoutId !== null) {
@ -263,8 +263,9 @@ export default {
return return
} }
useSyncConfigStore().setPreference({ path, value }) const oldValue = get(this.configSource, readPath)
const oldValue = get(this.configSource, path)
useSyncConfigStore().setPreference({ path: writePath, value })
const confirm = () => { const confirm = () => {
useSyncConfigStore().pushSyncConfig() useSyncConfigStore().pushSyncConfig()
@ -272,7 +273,7 @@ export default {
} }
const revert = () => { const revert = () => {
useSyncConfigStore().setPreference({ path, value: oldValue }) useSyncConfigStore().setPreference({ path: writePath, value: oldValue })
useInterfaceStore().clearTemporaryChanges() useInterfaceStore().clearTemporaryChanges()
} }

View file

@ -17,11 +17,11 @@ const APPEARANCE_SETTINGS_KEYS = new Set(
export const piniaStylePlugin = ({ store, options }) => { export const piniaStylePlugin = ({ store, options }) => {
if (store.$id === 'sync_config') { if (store.$id === 'sync_config') {
store.$onAction(({ name, args }) => { store.$onAction(({ name, args, after }) => {
if (name === 'setPreference') { if (name === 'setPreference') {
const { path, value } = args[0] const { path, value } = args[0]
if (APPEARANCE_SETTINGS_KEYS.has(path)) { if (APPEARANCE_SETTINGS_KEYS.has(path)) {
applyStyleConfig(store.mergedConfig) after(() => applyStyleConfig(store.mergedConfig))
} }
} }
}) })