From 35aeeb571c9bb42f232cc0f2f954af6087d84a4b Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Thu, 26 Sep 2024 11:20:51 -0400 Subject: [PATCH] Fixes setting the value in the main thread --- .../vitorpamplona/amethyst/ui/components/CashuRedeem.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/CashuRedeem.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/CashuRedeem.kt index 2200eea05..89f9e7fb2 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/CashuRedeem.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/CashuRedeem.kt @@ -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 } }