android / architecture-components-samples

Samples for Android Architecture Components.
https://d.android.com/arch
Apache License 2.0
23.46k stars 8.28k forks source link

afterObserve.invoke() only if latch is satisfied #1068

Open dgochev opened 1 year ago

dgochev commented 1 year ago

getOrAwaitValue in LiveDataTestUtil should invoke afterObserve only if the latch is satisfied (i.e. data was changed)

dgochev commented 1 year ago

Seems like the latch isn't entirely serving its purpose, and afterObserve isn't actually being done after observing. Maybe the name just isn't clear -- is the purpose of afterObserve to do something right after the .observeForever?