Fixed
Status Update
Comments
il...@google.com <il...@google.com>
il...@google.com <il...@google.com>
ap...@google.com <ap...@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
me...@gmail.com <me...@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.
Description
Component used: ViewModel Version used: 2.3.1 Devices/Android versions reproduced on: Emulator API 29
I just want to share a
ViewModel
object across navigation changes (using Jetpack Compose). I mean,ScreenA
is instantiatingMyViewModel
usingviewModel()
function. When I navigate (using Jetpack Navigation for Compose) toScreenB
and callviewModel()
from there, it returns a different instance.My current solution is a little ugly...
There's no
viewModel()
method that takes aViewModelStoreOwner
. It just always uses theLocalViewModelStoreOwner.current
.