Afzal Najam
08/27/2020, 6:09 PMliveData.postValue(StateOne)
2. Call liveData.postValue(StateTwo)
Actual:
The LiveData observer only receives StateTwo because inside postValue, while the mPostValueRunnable is being posted from the first call, pendingData gets replaced by the second call.
Is that expected or should LiveData be posting two separate runnables, one by one?Ian Lake
08/27/2020, 6:13 PMAfzal Najam
08/27/2020, 6:22 PMliveData.value is expected to deliver every state...right?Ian Lake
08/27/2020, 6:57 PMpost, you'll only get the latestAfzal Najam
08/27/2020, 7:01 PMliveData.value , that will deliver every time, right? Or is that also subject to the same behaviour as postValue?Casey Brooks
08/27/2020, 7:31 PMsetValue(), you shouldn’t write your code expecting that to happen. If you need to know the full history of events that are emitted, you should probably look into coroutine Channels or Flow instead, both of which can be tied into the lifecycleScope to achieve the same kind of app state guarantees that LiveData doesAfzal Najam
08/27/2020, 7:33 PMlifecycleScope. LiveData's been working well for the last year and a half with the app though. 🤷♂️Ian Lake
08/27/2020, 7:42 PMIan Lake
08/27/2020, 7:43 PMpostValueIan Lake
08/27/2020, 7:44 PMAfzal Najam
08/28/2020, 4:12 PM