Does orbit-mvi also support SingleLiveEvent-like a...
# orbit-mvi
m
Does orbit-mvi also support SingleLiveEvent-like alternative?
unable to find the samples in orbit-mvi though, did I miss something? 🙏
Been reading this article and seems
StateFlow
& Android lifecycle required additional configuration (there’s a new API from google to support this) also there’s an interesting discussion about it in here
m
Yes, it’s called the side effect flow. It’s dedicated for one-off events and you can access it from the
Container
. https://github.com/orbit-mvi/orbit-mvi/blob/main/orbit-core/README.md#subscribing-to-the-container https://github.com/orbit-mvi/orbit-mvi/blob/main/orbit-core/README.md#side-effect
✍️ 1
our implementation actually caches events when the collector is suspended so I don’t think you need to do anything special and can use
launchWhenStarted
Thanks for bringing this to my attention, I’ll have a read and see if this applies to Orbit!
🙏 1
@miqbaldc awesome find! Ultimately there’s nothing special we can do on our end to prevent the issue of dropping an event when you receive it during the window when the lifecycle receiver is paused. Ultimately the only thing we can do is to update our recommendation in samples and docs to use google’s new API.
m
Nice, well noted with thanks for the confirmation @Mikolaj Leszczynski 🎉 because the orbit-mvi is platform agnostic (only dependent with Kotlin), so there's no need to support this internally ✍️
👍 1