WAI
Status Update
Comments
il...@google.com <il...@google.com> #2
Yigit, do you have time to fix it?
reemission of the same liveData is racy
reemission of the same liveData is racy
my...@gmail.com <my...@gmail.com> #3
yea i'll take it.
ra...@cubera.ch <ra...@cubera.ch> #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.
il...@google.com <il...@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()
}
}
vi...@gmail.com <vi...@gmail.com> #6
Comment has been deleted.
vi...@gmail.com <vi...@gmail.com> #7
Comment has been deleted.
ag...@gmail.com <ag...@gmail.com> #8
Comment has been deleted.
ed...@gmail.com <ed...@gmail.com> #9
Seeing that the `launchWhenX` APIs will soon be deprecated, maybe it would a good idea to update the documentation at: https://developer.android.com/topic/libraries/architecture/coroutines#suspend .
Cause it might get confusing for people finding that documentation page and then being told that it's gonna be deprecated.
Cause it might get confusing for people finding that documentation page and then being told that it's gonna be deprecated.
Description
Component used: lifecycle
Version used: 2.6.0-beta01
Devices/Android versions reproduced on: N/A
launchWhenX
APIs are being deprecated. However, I do not see an alternative for running one-time suspend code.repeatOnLifecycle
does not match "one-time" andwithX
does not support suspend functions.