Avoids launching coroutines that were just launched.

pull/819/head
Vitor Pamplona 2024-03-26 09:09:35 -04:00
rodzic 75ac17b57d
commit b45f9bd460
2 zmienionych plików z 4 dodań i 3 usunięć

Wyświetl plik

@ -74,7 +74,7 @@ import com.vitorpamplona.quartz.events.EmptyTagList
import com.vitorpamplona.quartz.events.UserMetadata
import com.vitorpamplona.quartz.events.toImmutableListOfLists
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
@OptIn(ExperimentalFoundationApi::class)
@Composable
@ -88,7 +88,7 @@ fun RenderAppDefinition(
var metadata by remember { mutableStateOf<UserMetadata?>(null) }
LaunchedEffect(key1 = noteEvent) {
launch(Dispatchers.Default) { metadata = noteEvent.appMetaData() }
withContext(Dispatchers.Default) { metadata = noteEvent.appMetaData() }
}
metadata?.let {

Wyświetl plik

@ -180,6 +180,7 @@ import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toImmutableList
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.math.BigDecimal
@Composable
@ -1245,7 +1246,7 @@ private fun WatchApp(
var appLogo by remember(baseApp) { mutableStateOf<String?>(null) }
LaunchedEffect(key1 = appState) {
launch(Dispatchers.Default) {
withContext(Dispatchers.Default) {
val newAppLogo =
(appState?.note?.event as? AppDefinitionEvent)?.appMetaData()?.picture?.ifBlank { null }
if (newAppLogo != appLogo) {