Fixes setting the value in the main thread

This commit is contained in:
Vitor Pamplona 2024-09-26 11:20:51 -04:00
parent 70d68c89c8
commit 35aeeb571c

View File

@ -89,11 +89,9 @@ fun CashuPreview(
initialValue = CachedCashuProcessor.cached(cashutoken),
key1 = cashutoken,
) {
withContext(Dispatchers.IO) {
val newToken = CachedCashuProcessor.parse(cashutoken)
if (value != newToken) {
value = newToken
}
val newToken = withContext(Dispatchers.Default) { CachedCashuProcessor.parse(cashutoken) }
if (value != newToken) {
value = newToken
}
}