1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-29 16:02:51 -05:00

plugins: fix set ToggleSetting not saving

fixes #541
This commit is contained in:
bbedward
2025-10-24 13:12:16 -04:00
parent 0918412916
commit cf4a6969d3

View File

@@ -14,14 +14,23 @@ Row {
width: parent.width width: parent.width
spacing: Theme.spacingM spacing: Theme.spacingM
Component.onCompleted: { property bool isInitialized: false
function loadValue() {
const settings = findSettings() const settings = findSettings()
if (settings) { if (settings && settings.pluginService) {
value = settings.loadValue(settingKey, defaultValue) const loadedValue = settings.loadValue(settingKey, defaultValue)
value = loadedValue
isInitialized = true
} }
} }
Component.onCompleted: {
loadValue()
}
onValueChanged: { onValueChanged: {
if (!isInitialized) return
const settings = findSettings() const settings = findSettings()
if (settings) { if (settings) {
settings.saveValue(settingKey, value) settings.saveValue(settingKey, value)