Fixed
Status Update
Comments
jb...@google.com <jb...@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
ja...@deepl.com <ja...@deepl.com> #3
yea i'll take it.
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.
jb...@google.com <jb...@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()
}
}
ja...@deepl.com <ja...@deepl.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: Navigation
Version used: 2.4.0-beta02
Devices/Android versions reproduced on: Every device
I'm using Compose with the navigation components. I inject a ViewModel via Hilt.
I navigate with the
NavGraphBuilder.composable()
extension, which works.When I open my composable within a Dialog via the
NavGraphBuilder.dialog()
extension I run into the following problem:Closing the dialog with the system back button works. When I call
navController.popBackstack()
this exception occurs and the app crashes:I observed that my crashing composable is recomposed after
navController.popBackstack()
, which ultimately leads to the crash. Is there a reason for the additional recompositions?