From 92d9c682f81f8949233bda5c869462531dbff0d7 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Mon, 18 Mar 2024 16:38:40 -0400 Subject: [PATCH] This should be better than launching a new thread after LaunchedEffect already lauched hers. --- .../amethyst/ui/components/TranslatableRichTextViewer.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/play/java/com/vitorpamplona/amethyst/ui/components/TranslatableRichTextViewer.kt b/app/src/play/java/com/vitorpamplona/amethyst/ui/components/TranslatableRichTextViewer.kt index 6f8aab924..943ca482b 100644 --- a/app/src/play/java/com/vitorpamplona/amethyst/ui/components/TranslatableRichTextViewer.kt +++ b/app/src/play/java/com/vitorpamplona/amethyst/ui/components/TranslatableRichTextViewer.kt @@ -65,6 +65,7 @@ import com.vitorpamplona.amethyst.ui.theme.lessImportantLink import com.vitorpamplona.quartz.events.ImmutableListOfLists import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext import java.util.Locale @Composable @@ -367,7 +368,7 @@ fun TranslateAndWatchLanguageChanges( LaunchedEffect(accountState) { // This takes some time. Launches as a Composition scope to make sure this gets cancel if this // item gets out of view. - launch(Dispatchers.IO) { + withContext(Dispatchers.IO) { LanguageTranslatorService.autoTranslate( content, accountViewModel.account.dontTranslateFrom,