Status Update
Comments
jb...@google.com <jb...@google.com> #2
reemission of the same liveData is racy
ti...@google.com <ti...@google.com> #3
il...@gmail.com <il...@gmail.com> #4
ti...@google.com <ti...@google.com> #5
@Test
fun raceTest() {
val subLiveData = MutableLiveData(1)
val subject = liveData(testScope.coroutineContext) {
emitSource(subLiveData)
emitSource(subLiveData) //crashes
}
subject.addObserver().apply {
testScope.advanceUntilIdle()
}
}
ti...@google.com <ti...@google.com> #6
al...@gmail.com <al...@gmail.com> #7
I actually have a WIP fix for it:
if your case is the one i found (emitting same LiveData multiple times, as shown in #5) you can work around it by adding a dummy transformation.
val subLiveData = MutableLiveData(1)
val subject = liveData(testScope.coroutineContext) {
emitSource(subLiveData.map {it })
emitSource(subLiveData.map {it} )
}
ho...@gmail.com <ho...@gmail.com> #8
Branch: androidx-master-dev
commit af12e75e6b4110f48e44ca121466943909de8f06
Author: Yigit Boyar <yboyar@google.com>
Date: Tue Sep 03 12:58:11 2019
Fix coroutine livedata race condition
This CL fixes a bug in liveData builder where emitting same
LiveData source twice would make it crash because the second
emission registry could possibly happen before first one is
removed as source.
We fix it by using a suspending dispose function. It does feel
a bit hacky but we cannot make DisposableHandle.dispose async
and we do not want to block there. This does not mean that there
is a problem if developer disposes it manually since our emit
functions take care of making sure it disposes (and there is
no other way to add source to the underlying MediatorLiveData)
Bug: 140249349
Test: BuildLiveDataTest#raceTest_*
Change-Id: I0b464c242a583da4669af195cf2504e2adc4de40
M lifecycle/lifecycle-livedata-ktx/api/2.2.0-alpha05.txt
M lifecycle/lifecycle-livedata-ktx/api/current.txt
M lifecycle/lifecycle-livedata-ktx/api/public_plus_experimental_2.2.0-alpha05.txt
M lifecycle/lifecycle-livedata-ktx/api/public_plus_experimental_current.txt
M lifecycle/lifecycle-livedata-ktx/api/restricted_2.2.0-alpha05.txt
M lifecycle/lifecycle-livedata-ktx/api/restricted_current.txt
M lifecycle/lifecycle-livedata-ktx/src/main/java/androidx/lifecycle/CoroutineLiveData.kt
M lifecycle/lifecycle-livedata-ktx/src/test/java/androidx/lifecycle/BuildLiveDataTest.kt
es...@gmail.com <es...@gmail.com> #9
I'm also experiencing this issue using Navigation Compose 2.8.3
It also happens with the default animation with null transition arguments. Sometimes it just animates through scale in.
pr...@gmail.com <pr...@gmail.com> #10
Likely this is the same issue as
al...@gmail.com <al...@gmail.com> #11
cl...@gmail.com <cl...@gmail.com> #12
I'm still experiencing this issue in my app as of version 2.8.4. Seemingly at random I'll see a scale animation from the top left instead of my custom one.
Feel free to reference it here:
ap...@google.com <ap...@google.com> #13
Project: platform/frameworks/support
Branch: androidx-main
Author: Jeremy Woods <
Link:
Stop incorrect scaling animation when using NavHost
Expand for full commit details
Stop incorrect scaling animation when using NavHost
There is a case where if you can trigger a navigate call right before the
LaunchEffect that is responsible for managing the end of the
AnimatedContent's transition is called, you will get an incorrect scale
animation.
The reason for this is that the call to navigate adds the proper entries
to the visibleEntries list and then the LaunchedEffect immediately
remove it. Then when the AnimatedContent attempts to find this removed
entry it is not there and AnimatedContent thinks it is animated from
nothing and just scales from a blank screen.
Since this is an interrupt case the the AnimatedContent has not actually
finsihed with transition, we should not be hitting the `LaunchedEffect`
and marking the transition complete at all, but that needs to be
addressed by the Animation library so this change provides a workaround
in the mean time that just keeps from incorrectly marking the visible
entry's transition as complete.
RelNote: "Added a workaround to fix an issue that caused an unexpected
scale animation when using Navigation Compose."
Test: tested in sample app
Bug: 353294030
Change-Id: I26cb142affb046e94b34b9501e5405ddcf276fcf
Files:
- M
navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHost.kt
Hash: c270d4e53585ab6033d53a2eef1f5327da39e20d
Date: Thu Dec 05 23:09:52 2024
ap...@google.com <ap...@google.com> #14
Project: platform/frameworks/support
Branch: androidx-main
Author: Jeremy Woods <
Link:
Avoid race condition for transitions in NavHost
Expand for full commit details
Avoid race condition for transitions in NavHost
This is cleaning up the code added in aosp/3393408. The issue is caused
by a race condition where the previous animation has ended but the
current animation has yet to start because `animateTo` is still waiting
to acquire the `mutatorMutex`.
We need to verify that what `AnimatedContent` believes is the
`targetState` is the same thing that is on top of the back stack before
we mark the entries as complete.
RelNote: "Fix an issue that caused an unexpected scale animation when
using Navigation Compose."
Test: tested extensively in sample app
Bug: 353294030
Change-Id: I480f4d89ffc7e2dfa536a592a8fc7b6c759be1a4
Files:
- M
navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHost.kt
Hash: 4fbe698e1ff01037c6ed1a74538c0c1628ac1730
Date: Fri Dec 06 01:10:47 2024
jb...@google.com <jb...@google.com> #15
This has been fixed internally and will be available in the Navigation 2.8.5
release.
pr...@google.com <pr...@google.com> #16
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.navigation:navigation-compose:2.8.5
cl...@gmail.com <cl...@gmail.com> #17
Seems solid on my end
na...@google.com <na...@google.com> #18
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.navigation:navigation-compose:2.9.0-alpha05
Description
Component used: Navigation Compose
Version used: 2.8.0-beta05
Devices/Android versions reproduced on: Emulators, Pixel 8 Pro
Hello!
We occasionally encounter an issue where the NavHost randomly applies a default transition animation instead of the one specified for a particular composable/route. Please take a look at the sample project and screen recording I've attached. Even though composable<DefaultRoute> consistently defines slideInHorizontally/slideOutHorizontally transitions, you may sometimes observe a scale/fade animation instead. This bug is inconsistent and may require multiple attempts to reproduce. One observation is that this issue occurs more frequently when a new transition is requested just as the enter animation of a previous one is nearing completion.
Sample project:https://github.com/smelfungus/NavHostAnimationIssue
Screen recording:https://drive.google.com/file/d/1FPZavURTkuPmnAWJ49pFhIWvz3Qq-M7x/view?usp=sharing