diff --git a/coroutines/compose/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/compose/FlowAsListState.kt b/coroutines/compose/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/compose/FlowAsListState.kt index 6004f9d918f..3ce3e860eac 100644 --- a/coroutines/compose/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/compose/FlowAsListState.kt +++ b/coroutines/compose/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/compose/FlowAsListState.kt @@ -5,13 +5,14 @@ import androidx.compose.runtime.snapshots.SnapshotStateList import dev.inmo.micro_utils.common.applyDiff import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.StateFlow @Suppress("NOTHING_TO_INLINE") -inline fun StateFlow>.asMutableComposeListState( +inline fun Flow>.asMutableComposeListState( scope: CoroutineScope ): SnapshotStateList { - val state = mutableStateListOf(*value.toTypedArray()) + val state = mutableStateListOf() subscribeSafelyWithoutExceptions(scope) { state.applyDiff(it) } @@ -19,7 +20,7 @@ inline fun StateFlow>.asMutableComposeListState( } @Suppress("NOTHING_TO_INLINE") -inline fun StateFlow>.asComposeList( +inline fun Flow>.asComposeList( scope: CoroutineScope ): List = asMutableComposeListState(scope)