Fork me on GitHub
Ahmed Hassan07:07:41

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


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.


My only suggestion is to use do :-)

👍 4

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

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?


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)