diff --git a/coroutines/compose/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/compose/FlowAsState.kt b/coroutines/compose/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/compose/FlowAsState.kt index 334c5dcb6ea..b6d6fb12833 100644 --- a/coroutines/compose/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/compose/FlowAsState.kt +++ b/coroutines/compose/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/compose/FlowAsState.kt @@ -1,6 +1,7 @@ package dev.inmo.micro_utils.coroutines.compose import androidx.compose.runtime.* +import dev.inmo.micro_utils.coroutines.doInUI import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.Flow @@ -11,7 +12,7 @@ fun Flow.asMutableComposeState( scope: CoroutineScope ): MutableState { val state = mutableStateOf(initial) - subscribeSafelyWithoutExceptions(scope) { state.value = it } + subscribeSafelyWithoutExceptions(scope) { doInUI { state.value = it } } return state }