Update CachedMutableValue.kt

This commit is contained in:
1
2025-07-17 11:14:00 +08:00
parent 17b4ffa75d
commit 472a4849f0

View File

@@ -58,14 +58,12 @@ inline fun <reified T, reified C : Iterable<T>> cachedMutableOf(value: C, key: S
}
},
getter@{
var result = value
errorDialog("读取数据失败 key=${key}") {
if (kv.containsKey(key)) {
val json: C = kv.decodeString(key)?.parseJsonObject() ?: value
result = json
}
if (!kv.containsKey(key)) {
return@getter value
}
return@getter result
errorDialog("读取数据失败 key=${key}") {
kv.decodeString(key)?.parseJsonObject()
} ?: value
}
)