Fork me on GitHub
#re-frame
<
2019-07-19
>
Ahmed Hassan07:07:41

How can we dispatch multiple events using something like #(re-frame/dispatch [[...][...]])

mikethompson07:07:16

In an event handler you would use the :dispatch-n effect

👍 4
Ahmed Hassan07:07:24

Similar to {:dispatch-n [[...] [...]} effect.

Ahmed Hassan07:07:39

I want to dispatch from UI.

mikethompson07:07:58

My only suggestion is to use do :-)

👍 4
valtteri15:07:54

I've found that sometimes dispatching several events from views at once is a smell. I've ended up refactoring such cases to dispatch a single event with a good and describing name and then using dispatch-n in that events handler if necessary.

👍 8
atticmaverick20:07:17

i want to have something like a "replayable" interceptor that stores the event to be potentially replayed after an effect. Im confused as to how I can associate the original "replayable" event after a callback from a effect. Do i need to pass additional information to the effect?

atticmaverick20:07:13

what im trying to do is dispatch an event that does a POST to a server from a group (server A and server B). what i would like to do is on certain failures attempt the original event on the other server (if server A fails try server B)