Hey :wave: Using the experimental API, how do you ...
# mvikotlin
n
Hey 👋 Using the experimental API, how do you retrieve the
CoroutineScope
of the executor inside
coroutineExecutorFactory
or
onIntent
? I’d like to use the same mechanism as with the previous API for my flows to be automatically cancelled when the scope is disposed.
✅ 1
Just realised, but not deleting the message in case it’s useful in the future.
this
is actually a
CoroutineScope
inside
onIntent
and
onAction
, allowing this:
Copy code
executorFactory = coroutineExecutorFactory {
    onAction<X> {
        flow
            .onEach{...}
            .launchIn(this)
    }
}
That’s brilliant, Arkadii. I love this new experimental API. Maybe this can be documented a bit further, though, I had to deep dive into MviKotlin to find it.
a
Thanks for pointing it out! I think it's actually time to make the DSL stable. Filed https://github.com/arkivanov/MVIKotlin/issues/96
The update to Kotlin 1.9.0 is blocked by https://youtrack.jetbrains.com/issue/KT-62001 So it may take some time.