Sep 7, 2018 · 1 min read
Thanks for posting - I think you’ve done a great job describing the problem and some possible solutions.
For those of us trying to follow Redux-like patterns (i.e. uni-directional data flow with immutable data) your recommendations aren’t viable. The Event wrapper will get you into all sorts of trouble since it is mutable. SingleLiveEvent could be used, but as you acknowledge it has some limitations so isn’t a general-purpose solution.
Fortunately, something which amounts to Option 2 is workable: have the UI trigger an action to modify the state when it acts on the event. You can also use state in place of events in some cases — e.g. for navigation, don’t have a “navigate to details” event, just make the screen part of the state.