I have a StateFlow<SyncState> which is writt...
# coroutines
u
I have a StateFlow<SyncState> which is written to by coroutines running on Dispatchers.IO I collect this in a ViewModel to drive UI, so the scope is driven by Dispatchers.Main I also collect this in some other place, where the scope is driven by IO Sometimes the ui driven collector doesnt receive emits (and the io collector does, so the StateFlow does actually gets written to correctly), randomly, like 1 in 10-15 I suspect this is when the writes are too close together in time? Is there a legitimate reason for all emits to be dropped in Main threaded collector due to some backpressure or something? Shouldnt I atleast see the last emit? (And yes the scope is still active, I checked) Bug?
a
Are you sure this is not a result of conflation?
u
@Anvith how so? conf. should emit the latest value, no?
btw do you know, are there any equals checks in conflation?
l
MutableStateFlow does a combination of distinctUntilChanged and conflate.
u
I was only aware of the != equals checks when setting the value, didn't know about the collector level equals checks