I created a simple exercise for me to test the action hang-back and cancellation:
I ended up with putting the logic just in state-function and actions, looks simpler than the one below:
https://github.com/sladiri/sam-simpler/blob/feature/actionID_in_actions_and_stateFn/src/main.js
An alternative looks a lot more complex, where the model checks too, but it does not seem worth it:
https://github.com/sladiri/sam-simpler/blob/feature/actionID_in_model/src/main.js
The alternative would simply have been:
// action
actions.model.present({resultSet})
// model
if (data.resultSet) {
model.resultSet = data.resultSet ;
}
model.state.render(this)
// state
stateRepresentation = state.view.theme.results(model.resultSet)
You are just skipping a step that has no incidence on the application state.
m()
syntax if it's not your preference.