Nacho Ruiz Martin
12/30/2022, 3:28 PMval state by store.states.collectAsState()
Everything is good if I tap the keyboard slowly, but when tapping faster the caret starts behaving oddly, not always being positioned after the last character but staying behind.
I’ve been reading about this and the recommendation from Google is to return control of the TextField immediately (not do it in an async way). More info here and here.
I can’t see a way to do this with MviKotlin, though. Any idea?Arkadii Ivanov
12/30/2022, 4:04 PMcollectAsState(Dispatchers.Main.immediate)
Nacho Ruiz Martin
12/30/2022, 4:05 PMNacho Ruiz Martin
12/30/2022, 4:05 PMArkadii Ivanov
12/30/2022, 4:08 PMcollectAsState
could use Dispatchers.Main.immediate
by default, instead of just Dispatchers.Main
. This would be aligned with ViewModel
, which uses Dispatchers.Main.immediate
internally for its viewModelScope
.Nacho Ruiz Martin
12/30/2022, 4:13 PMDispatchers.Main.immediate
dispatcher only did the problem worse 🤔 .
Before, it was happening from time to time and now it’s happening always.Nacho Ruiz Martin
12/30/2022, 4:16 PMgist
is using Jetpack’s ViewModel and I’m using a simple MviKotlin store.Arkadii Ivanov
12/30/2022, 4:18 PMExecutor
and call dispatch(Effect)
directly.Nacho Ruiz Martin
12/30/2022, 4:21 PMstateIn
for it to be a StateFlow
and the coroutine scope passed to stateIn
is the one provided by the lifecycle of the NavBackStackEntry.
Could that be related?Nacho Ruiz Martin
12/30/2022, 4:23 PMMain.immediate
too, though.Arkadii Ivanov
12/30/2022, 4:24 PMstateFlow
extension function, so you won't need stateIn
. Currently, you can grab the implementation from there: https://github.com/arkivanov/MVIKotlin/blob/d36b55ef4980dcb579956b42baf449d905e06f[…]otlin/com/arkivanov/mvikotlin/extensions/coroutines/StoreExt.ktNacho Ruiz Martin
12/30/2022, 4:26 PMstateFlow
extension and I’m eager to use it!
I’ll try with a custom scope and with the grabbed implementation and let yo know.Nacho Ruiz Martin
12/30/2022, 4:35 PMArkadii Ivanov
12/30/2022, 4:53 PM