Has anyone ever mentioned that it'd be less confusing if you Swap the naming of Result and Action? 🙂 Having executors send a result to a reducer is confusing because reducers usually take an intent and state to create a new state.
a
Arkadii Ivanov
10/15/2021, 8:36 PM
I would agree, thinking about it 🤔
n
Nikola Milovic
10/17/2021, 6:31 AM
Action is something that has to be performed, Executors do some kind of business logic based on Intents and Produce a Result. Result of that calculations changes State. Reducers take the result of the Intent not the Intent itself in definition
a
Arkadii Ivanov
10/17/2021, 10:46 AM
It depends, in most of the cases we send results to the reducer, something happened and we need to change the state. But sometimes we need to send a command to the reducer from the executor. For example consider a store with a list of users. It has Intent.RemoveUser(id). In this case it might be useful to dispatch something like RemoveUser (I'd) to the reducer as well. Filed an issue where it can be tracked: https://github.com/arkivanov/MVIKotlin/issues/304