re-frame

https://github.com/Day8/re-frame/blob/master/docs/README.md https://github.com/Day8/re-frame/blob/master/docs/External-Resources.md
Rabie 2020-06-28T02:33:35.101100Z

It is very clear Mike, Just may be one confusion for me that might need clarifying. I understant how functions are associated with :db and :GET that are defined in the event handler. But may be it might be interesting to show how this logic is similar/different with a :dispatch key used to dispatch a new event

Rabie 2020-06-28T02:46:09.103600Z

I was reading the effects doc and I have a question with regard to :

(reg-event-fx              ;; -fx registration, not -db registration
  :my-event
  (fn [cofx [_ a]]        ;; 1st argument is coeffects, instead of db
    {:db       (assoc (:db cofx) :flag  a)
     :dispatch [:do-something-else 3]})) 
Is there a way to dispatch more than one event with the :dispatch key? If not, is it because this use case should never be used and should I use a different logic?

2020-06-28T03:41:55.104Z

@rnait1977 there is an effect called :`dispatch-n`

Rabie 2020-06-29T01:47:48.118200Z

In that case, is the cofx passed to these :dispatch-n or :dispatch events the same as the original cofx of the reg-event-fx or the one that has been modified by the :db key?

2020-06-28T03:42:14.104400Z

which, can take a seq of vectors to dispatch

🙏 1
2020-06-28T03:44:42.104500Z

@gekkostate Yes, exactly correct. Consider an app which maintains a list of thingos in app-db. And that this list is displayed in one panel, in a sorted way. When that panel is not showing, we don't need the list of thingos sorted. Only when that panel is showing should we go to the computational effort of sorting. In such a case, we'd put the sorting in the subscription. The need for sorting is associated with the existence of a view subscribing to the data in that way. @neo2551 ^^

valerauko 2020-06-28T12:29:20.113Z

is there a list of built-in effect handlers? like the ones that deal with :dispatch and dispatch-n

p-himik 2020-06-28T12:37:05.113100Z

There doesn't seem to be one. There's this section http://day8.github.io/re-frame/Effects/#existing-effect-handlers that has to links, but neither of them shows anything useful. But it's pretty easy to search for the usages of reg-fx in the re-frame source code.

valerauko 2020-06-28T12:38:25.113400Z

so i figure this is all then https://github.com/day8/re-frame/blob/master/src/re_frame/fx.cljc

p-himik 2020-06-28T12:42:57.113700Z

Yep. But there's a number of third-party libraries that add some extra interceptors.

2020-06-28T13:11:19.113900Z

Yeah, in the recent docs upgrade, the list of buildin effect handlers was removed.

2020-06-28T13:11:22.114100Z

I'll fix that

👍 1
2020-06-28T13:11:39.114600Z

Newly refined infographics on this page ... https://day8.github.io/re-frame/event-handling-infographic/

2020-06-28T13:11:57.115Z

I'm interested in comments

2020-06-28T13:12:43.115900Z

@p-himik I added a new panel to stress the FIFO nature of the event queue.

2