re-frame

daveliepmann 2023-12-06T16:51:23.005539Z

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?

p-himik 2023-12-06T16:55:00.958699Z

Because coeffects aren't effects. Coeffects - inputs to event handlers. Effects - results of event handlers.

1
daveliepmann 2023-12-06T20:37:21.926509Z

If only there were a tautology emoji!

Kimo 2023-12-07T18:49:43.874029Z

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.

๐Ÿ‘ 1
Kimo 2023-12-07T18:51:20.196409Z

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.

Kimo 2023-12-07T19:15:07.084599Z

So basically what makes it not suitable is that it has keys for which there is no registered effect handler.

Kimo 2023-12-07T19:42:57.562349Z

https://day8.github.io/re-frame/FAQs/use-cofx-as-fx/

โ— 1
daveliepmann 2023-12-07T19:54:36.892879Z

Whoa, thanks, I definitely did not find that before

daveliepmann 2023-12-07T19:58:08.150459Z

I now understand "I guess the confusion stems from the :db coeffect having the same key as the :db effect.", that really helps

Kimo 2023-12-07T20:12:51.426879Z

just published it, haha

๐Ÿ™ 1
daveliepmann 2023-12-07T20:19:59.877389Z

oh okay ๐Ÿ˜‚ that solves the mystery

2023-12-08T14:15:14.103369Z

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.

๐Ÿงผ 1