reactiveui / ReactiveUI

An advanced, composable, functional reactive model-view-viewmodel framework for all .NET platforms that is inspired by functional reactive programming. ReactiveUI allows you to abstract mutable state away from your user interfaces, express the idea around a feature in one readable place and improve the testability of your application.
https://www.reactiveui.net
MIT License
8.06k stars 1.12k forks source link

Issue with docs/handbook/message-bus/index.md #2547

Closed nbloms closed 3 years ago

nbloms commented 4 years ago

Hi,

I've tried to implement the pattern on the message-bus page that observes commands from viewmodels in a ObservableList. I have issues with getting this to work consistently on Android and iOS.

The example on this page doesn't work at all, as is, on either platform for me in a blank Xamarin Forms application. It does however work on iOS if I set the outputscheduler of the DocumentViewModels Close command to RxApp.TaskpoolScheduler and set an ObserveOn(RxApp.MainThreadScheduler) before the Subscribe in the MainViewModel (see gist below).

On Android it works intermittently with these changes.

Here is a gist with the ViewModel and View that I've used when I tried to get it to work. https://gist.github.com/nbloms/1f89ade2c7f321fa36dda84b8081ced8 I'm trying to execute the Close command of the first DocumentViewModel in the Clicked callback of a button. With my above changes the list of DocumentViewModels is emptied with 4 clicks on iOS and around 10 on Android. Without the changes nothing happens when I click the button.

I have tested both with simulator/emulator and on a physical device and I get the same behaviour regardless.

Would greatly appreciate if anyone would take their time to test the code from my gist and try to figure out what is happening. Thanks!

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.