Thanks for that. I think that makes total sense, and being able to handle 1 action in multiple places was something I was not sure if it was an anti pattern or not.
One pattern I’ve been applying as I’ve been working with this is splitting up my state into 3 sections: Navigation State, UI State, and Domain state. So something like user session would live in domain state, and the state of the profile UI would live down in UI State.
Then whenever I create the state observable for a particular view controller I pluck off the pieces of state it needs to derive the final result from the Domain State and UI State. In this case the key paths might be like domainState.userSession
and uiState.profileUIState
. This seems to help with normalizing my state and overall organization of my whole app state.
I am a little concerned with the state updates firing for all the observables since its harder for them to be .outOfScope
since the navigation state and ui state are not coupled like in the Koober example, but I think in my state getters I could check the navigation state and make sure it matches the piece of state I’m trying to select.