This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-01-10
Channels
- # announcements (15)
- # bangalore-clj (1)
- # beginners (207)
- # calva (22)
- # cider (4)
- # clara (73)
- # cljs-dev (7)
- # cljsrn (4)
- # clojure (125)
- # clojure-dev (38)
- # clojure-europe (2)
- # clojure-india (11)
- # clojure-italy (11)
- # clojure-nl (14)
- # clojure-russia (22)
- # clojure-uk (32)
- # clojurescript (30)
- # cursive (11)
- # datavis (2)
- # datomic (14)
- # editors (3)
- # emacs (3)
- # hyperfiddle (4)
- # juxt (13)
- # klipse (1)
- # luminus (5)
- # nrepl (7)
- # off-topic (9)
- # overtone (13)
- # portkey (1)
- # re-frame (15)
- # reagent (13)
- # ring (30)
- # schema (4)
- # shadow-cljs (108)
- # spacemacs (8)
- # specter (3)
- # sql (2)
- # testing (11)
- # tools-deps (21)
- # unrepl (4)
Another n00b question, but what is the preferred way to dispatch initialziation events associated with a component (outside of using an form-3 component). The docs have examples of initializing the entire app, but that's not a applicable inside a component body. Is the solution to try to be idempotent?
mainstream opinion w.r.t. re-frame is that you don’t associate events with rendering a particular component
usually, rendering a particular component is associated with a user event. your state change then should happen in an effect that’s associated with that particular user event
I’m struggling a bit with http-xhrio
. I would like to have a chance to process the data returned from the ajax call before it is dispatched to the :on-success
handler. This way, each :on-success
handlers doesn’t have to do the processing itself.
There are :interceptors
in cljs-ajax
, but they run before the :response-format
interceptor, so all I get is the response text as a string - I’m really trying to process the result of converting the text response into a cljs map, which happens in the :response-format
function.
I was toying with the idea of detecting the :on-success
vector, and replacing it with one of my own that gets the response and dispatches the original :on-success
with the processed data, but then I started to get that feeling where “boy this seems harder than it should be”, so I’m asking the experts for any ideas.
i would still need to use that interceptor on every event that handles the ajax result, right?
i’m trying to put myself in a situation where the on-success handlers of any ajax call don’t have to remember to add an interceptor, or process the data the same as all the other success handlers, because i’m gonna wind up with one that forgets, and have unprocessed data in my app db, and slowly die as i try to debug that 🙂
either way, it’s going to be gross. I think having a common interceptor that most event-fx can use would be the way I would try to do it