Fixed
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
jb...@google.com <jb...@google.com>
sa...@google.com <sa...@google.com>
sa...@google.com <sa...@google.com>
jb...@google.com <jb...@google.com> #3
yea i'll take it.
sa...@google.com <sa...@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.
gs...@gmail.com <gs...@gmail.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()
}
}
na...@google.com <na...@google.com> #6
With 2.2.0-alpha04 (that use Main.immediate), the issue seems to be still there (I tested it by calling emitSource() twice, like your test case)
Description
Component used: Fragment
Version used: 1.5.0-rc01
Tryin to attach an https://issuetracker.google.com/issues/149173280#comment5
OnBackPressedDispatcher
to aDialogFragment
'sDialog
, I have to cast the returnedDialog
to aComponentDialog
to be able to access the back dispatcher. I've also seen this provided as an example hereGiven that requireActivity() ), why is
ComponentActivity
is a part of the fragment API throughFragmentActivity
(e.g.ComponentDialog
not a part of aDialogFragment
API inrequireDialog()
andonCreateDialog()
As extra information, there's a possible alternative to casting the dialog, by using
View.findViewTreeOnBackPressedDispatcherOwner()