Fork me on GitHub
#re-frame
<
2020-06-28
>
Rabie02:06:09

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?

mikethompson03:06:55

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

Rabie01:06:48

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?

mikethompson03:06:14

which, can take a seq of vectors to dispatch

🙏 3
valerauko12:06:20

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

p-himik12:06:05

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.

p-himik12:06:57

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

mikethompson13:06:19

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

mikethompson13:06:22

I'll fix that

👍 3
mikethompson13:06:57

I'm interested in comments

mikethompson13:06:43

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

bmo 6