This should be better than launching a new thread after LaunchedEffect already lauched hers.

pull/810/head
Vitor Pamplona 2024-03-18 16:38:40 -04:00
rodzic f5a1007f88
commit 92d9c682f8
1 zmienionych plików z 2 dodań i 1 usunięć

Wyświetl plik

@ -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,