Closed ichrisanderson closed 5 years ago
Thanks for reporting, I don't have much time to look into it right now.
@oldergod @chrisanderson79
Take a look this code
override fun onResume() {
super.onResume()
// conflicting with the initial intent but needed when coming back from the
// AddEditTask activity to refresh the list.
refreshIntentPublisher.onNext(TasksIntent.RefreshIntent(false))
}
since refreshIntent() having a function mergeWith refreshPublishIntent, on callback onResume there is a emissions that emit a value to the publish subject.
This causing emissions happened multiple times
Thank you @radityagumay , do you have a proposal to fix that?
The problem was introduced trying to fix #46 I reverted the code so this issue should be fixed now.
@oldergod thank you!
For example, on the TasksFragment if you background the app and then restore you can end up with multiple RefreshIntents being processed, adding some logs you can see this below.
The issue looks to be related to the processIntents method with the ViewModel, where intents are subscribed multiple times but the old subscription never gets disposed. Its possible to ignore the duplicates by using the
distinct
operator but there's maybe a question as to whether you want to keep the old subscription active in the ViewModel