I just ran into "https://github.com/Day8/re-frame/issues/536" The fix works, however, I lack an intuition for why we can't use a modified copy of the input map as output. What is it about a cofx map that makes it not suitable as an effects map?
Because coeffects aren't effects. Coeffects - inputs to event handlers. Effects - results of event handlers.
If only there were a tautology emoji!
I kind of wish you could do that, too. event-db handlers feel like reducing functions, transforming their argument, but event-fx-handlers have to explicitly build an fx map.
I guess the confusion stems from the :db coeffect having the same key as the :db effect. On the other hand, :event is a coeffect, but there's no corresponding :event effect.
So basically what makes it not suitable is that it has keys for which there is no registered effect handler.
Whoa, thanks, I definitely did not find that before
I now understand "I guess the confusion stems from the :db coeffect having the same key as the :db effect.", that really helps
just published it, haha
oh okay ๐ that solves the mystery
I am using it in this way everywhere in our code base. We have a clean interceptor which cleans :event and a few other keys on the output. It works very well.