This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-08
Channels
- # announcements (5)
- # babashka (46)
- # beginners (206)
- # boot (1)
- # bristol-clojurians (1)
- # calva (9)
- # chlorine-clover (27)
- # cider (1)
- # clara (10)
- # clj-kondo (105)
- # cljsrn (2)
- # clojars (1)
- # clojure (104)
- # clojure-europe (6)
- # clojure-nl (2)
- # clojure-uk (18)
- # clojurescript (44)
- # conjure (10)
- # core-async (34)
- # cursive (28)
- # data-science (6)
- # datomic (14)
- # emacs (44)
- # events (1)
- # figwheel-main (1)
- # fulcro (13)
- # graphql (9)
- # helix (12)
- # kaocha (2)
- # meander (4)
- # off-topic (2)
- # pathom (1)
- # quil (1)
- # re-frame (21)
- # shadow-cljs (49)
- # spacemacs (6)
- # xtdb (8)
Nope. Adding a line vs adding an underscore was the trade off. Moreover I like to have access to the event by default in my handler.
I have my own versions of reg-event-*
functions that I use in my projects that add trim-v
by default, along with some other interceptors.
@p-himik I've been browsing old re-frame issues, cleaning up. I'd be interested to know where you stand now on this issue https://github.com/day8/re-frame/issues/264#issuecomment-338485510
Please also see https://github.com/day8/re-frame/issues/264#issuecomment-625823359
Regarding where I stand - sigh, yeah, I still "suffer" because of passing around maps of parameters and using multimethods. I'm think about it from time to time and read some relevant articles (https://staltz.com/unidirectional-user-interface-architectures.html and https://kickstarter.engineering/namespacing-actions-for-redux-d9b55a88b1b1 are pretty good IMO). But so far the best idea that I have in mind is to pass everywhere a single ctx
that would contain "higher-order dispatch
and subscribe
". From the POV of sub-components, they're just regular functions, the ones everybody's used to. From the POV of outer components, they're functions that alter the default behavior of subscribe
or dispatch
. It may be injecting some sub-paths somehow, it may be changing some parameters (depending on what the sub-components ask for), resolving to the default behavior, or even being a no-op.
Alas, I haven't had the time to test it on a "real world application". I feel like for me to try it out properly I would need a sabbatical.
Does anyone have good examples of the kinds of issues that overusing ‘dispatch-sync’ would cause?
Is there a name for the double-colon ::model/dispatch
pattern? I’m trying to learn a codebase that dispatches events this way. It seems model is the name of an aliased requirement, but I can’t seem to be able to recreate this on my own. Also, new to re-frame.
I see an error no :event handler registered for:
in the console. It does appear to be pointing to my proper NS
Ah nice… so i dispatch ::model/fetch
and then in the model ::fetch
picks it up! Thanks!
What's the right place to implement (effectful) event retries or other "Middleware" that causes side effects? E.g. an event that calls a http endpoint, if it results in a 401, fetch the token from another endpoint, then dispatch again? Seems like it could quickly lead to event spaghetti.
I think I’ve seen people using https://github.com/day8/re-frame-async-flow-fx to do similar things

^ +1
Used async-flow-fx
successfully for a small state machine, very similar to what you've described.
For large things it might get unwieldy, though
Hello, I am just starting with re-frame and I have a question. On :load-data event I would like to load data into db from Parse server. I call Parse cloud function which returns promise, so it is not AJAX call and I cannot use re-frame-http-fx. Is there any other way or I just have to dispatch another events on promise resolve/reject? Thanks
@ptylka Your :load-data
event should dispatch an effect (let’s call it :parse-effect
). In the :parse-effect
handler you would call Parse, and when the promise resolves, you would dispatch another event like :load-data-into-db-from-parse-response
which takes the response, parses it, and loads it into the app-db.
thanks 🙂