This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-06
Channels
- # announcements (4)
- # beginners (132)
- # calva (37)
- # chlorine-clover (60)
- # cider (1)
- # clara (12)
- # clj-kondo (40)
- # cljs-dev (109)
- # clojure (76)
- # clojure-dev (19)
- # clojure-europe (8)
- # clojure-france (17)
- # clojure-nl (4)
- # clojure-sg (1)
- # clojure-spec (14)
- # clojure-uk (7)
- # clojurescript (98)
- # conjure (96)
- # cursive (15)
- # data-science (2)
- # datalog (11)
- # datomic (24)
- # emacs (17)
- # figwheel-main (3)
- # fulcro (45)
- # jobs-discuss (1)
- # kaocha (3)
- # malli (2)
- # nrepl (1)
- # off-topic (135)
- # portal (2)
- # re-frame (17)
- # reagent (11)
- # reitit (4)
- # sci (60)
- # shadow-cljs (75)
- # spacemacs (3)
- # sql (32)
- # tools-deps (79)
- # vim (88)
- # xtdb (4)
In the re-frame docs (http://day8.github.io/re-frame/Effects/) it refers to "`re-frame's` built-in effect handlers, like `dispatch-n` and `dispatch-later`, are detailed in https://day8.github.io/re-frame/codox/ document." But on that page I see defined only dispatch
and dispatch-sync
. What am I missing?
Actually I am not sure that codox page is working. None of the links do anything for me (Chrome 84, macOS 10.14.6)
I'm trying to remember how one should dispatch events from an event handler. I suspect using dispatch-async
directly is counter-indicated and you should be using reg-event-fx
and having something else trigger the dispatch but I can't seem to find it in the docs.
It seems like either {:dispatch []}
is an example not implemented or there is magic functionality that makes it work not documented. For example if I want do dispatch two events as a side-effect, can I :dispatch [[evt1][evt2]]
?
@sandbags Sorry, that link on that page is old and wrong (now corrected). This is the link you should be using ... https://day8.github.io/re-frame/api/#api-builtin-effects.html
It seems like you might want effects like this:
{ :db (assoc db :something :else)
:dispatch-n (list [:first-event] [:second-event "yeah"])}
^^^ note that's :dispatch-n
and not :dispatch
Thanks @mikethompson I eventually ended up spelunking into fx.cljc but grateful for the confirmation. I've been away from re-frame too long!
In our project, our views.cljs is growing pretty fast, are there any patterns or naming conventions for moving to a views folder then having files for each page or group of components?
I usually write a namespace for components that will work together. Similar to the hexagonal architecture.
Okay, I'll bite. Hexagonal architecture is a new one on me… where can I find out more?
It just means that you will write many fully qualified events and subs, and only few of them will be global and shared.
I had heard of this in another context, is it the same? https://netflixtechblog.com/ready-for-changes-with-hexagonal-architecture-b315ec967749
Yep! For re frame, the transport layer would be the events and subscriptions and entities would be the dB.