Fixed
Status Update
Comments
mr...@gmail.com <mr...@gmail.com> #2
Yigit, do you have time to fix it?
reemission of the same liveData is racy
reemission of the same liveData is racy
il...@google.com <il...@google.com>
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #4
Thanks for the detailed analysis. This may not be an issue anymore since we've started using Main.immediate there but I' not sure; I'll try to create a test case.
pr...@google.com <pr...@google.com> #5
just emitting same live data reproduces the issue.
@Test
fun raceTest() {
val subLiveData = MutableLiveData(1)
val subject = liveData(testScope.coroutineContext) {
emitSource(subLiveData)
emitSource(subLiveData) //crashes
}
subject.addObserver().apply {
testScope.advanceUntilIdle()
}
}
@Test
fun raceTest() {
val subLiveData = MutableLiveData(1)
val subject = liveData(testScope.coroutineContext) {
emitSource(subLiveData)
emitSource(subLiveData) //crashes
}
subject.addObserver().apply {
testScope.advanceUntilIdle()
}
}
Description
LiveDataReactiveStreams
has been converted to kotlin andlifecycle-reactivestreams-ktx
has been merged intolifecycle-reactivestreams
as of this change (LiveData.toPublisher()
kotlin extension method has a different parameter ordering, we needed to keep the originalLiveDataReactiveStreams.toPublisher()
extension method. We should deprecate this method to point developers to theLiveData.toPublisher()
kotlin extension method.