Fixed
Status Update
Comments
ch...@google.com <ch...@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
tc...@google.com <tc...@google.com> #3
yea i'll take it.
an...@google.com <an...@google.com>
b9...@gmail.com <b9...@gmail.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.
ap...@google.com <ap...@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
1) We can do the whole recomposition when the items count changed as we can't change size without the recomposition
2) But we can react on item changes only for the currently visible items.
I prototyped how it can work from the compose side:
But it has quite a lot of todos where I am not sure what callbacks from Paging to be using to update the compose states. Could you please help with figuring it out?