Fix issue where recipient observing could show stale data.

This commit is contained in:
Greyson Parrelli
2021-01-07 14:56:26 -05:00
committed by Alan Evans
parent dda68d6c95
commit fba4ae91e3
2 changed files with 23 additions and 16 deletions

View File

@@ -87,11 +87,10 @@ public final class LiveRecipient {
*/
public void observeForever(@NonNull RecipientForeverObserver observer) {
Util.postToMain(() -> {
observers.add(observer);
if (observers.size() == 1) {
if (observers.isEmpty()) {
liveData.observeForever(foreverObserver);
}
observers.add(observer);
});
}