This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-06-27
Channels
- # bangalore-clj (2)
- # beginners (37)
- # boot (16)
- # cider (17)
- # clara (4)
- # cljs-dev (351)
- # cljsrn (16)
- # clojure (219)
- # clojure-belgium (4)
- # clojure-dev (3)
- # clojure-france (2)
- # clojure-italy (24)
- # clojure-russia (23)
- # clojure-spec (55)
- # clojure-switzerland (3)
- # clojure-uk (89)
- # clojurescript (121)
- # cursive (2)
- # datomic (29)
- # devops (2)
- # graphql (8)
- # hoplon (15)
- # immutant (5)
- # lein-figwheel (4)
- # liberator (3)
- # luminus (18)
- # off-topic (9)
- # om (6)
- # onyx (31)
- # pedestal (48)
- # precept (9)
- # re-frame (19)
- # reagent (63)
- # ring-swagger (69)
- # robots (1)
- # slack-help (14)
- # spacemacs (12)
- # sql (2)
- # test-check (4)
- # unrepl (28)
- # untangled (5)
- # yada (3)
I think if you move your @
from the let
down into the :value (:testfield @formdata)
it should work
Hello all, do you think is there side effects doing this?
(reg-event-db
:clean-login-fields
(fn [db [_]]
(assoc db :username ""
:password ""))
or
(reg-event-fx
:clear-login-fields
(fn
[{:keys [db]} [_]]
{:db (assoc db
:acesso/username ""
:acesso/password "")}))
?@fabrao From what I understand those two are equivalent, the first one is just sugar for the most common situation (you only care about the db). As for side-effects, there are no direct side effects as the functions are pure (they take a value and return another one). Of course re-frame will use those values to perform side effects (update the db atom), but that's abstracted away so you, the user, don't have to care about those details.
can you access the current db from an effectful handler registered with reg-fx
(will be useful for writing stub handlers that write/read to the db instead of performing side effects)
and other things
@danieleneal effects handlers are only get given (as a parameter) the data associated with their key
Remember that an interceptor's :after
fn can modify db
. Not sure if that helps.
mmm thanks yeah, I've been using interceptors sometimes and effects handlers in other times,
I guess I can always "upgrade" an effects handler to an interceptor? Or call reframe/dispatch and make the changes to the db in the subsequent handler
I'm still at that newbie stage where I'm figuring out when it is appropriate to use which abstraction
@danieleneal I did: (reg-event-fx :params-fx (fn [{:keys [db]} params] {:side-effect (assoc db :params params)})
Then (reg-fx :side-effect (fn [db] (awesome!Stuff!! db) true) )
ah I see 🙂 just add another layer!
neat tip
Hello. Question about re-com: is it possible in current single-dropdown to render html in primary input (not in options)?
I'm trying to send a JSON payload using day8.re-frame.http-fx
. I've included :format :json, :params {:foo "bar"}
in my request map. The request goes out with JSON Content-Type headers but Content-Length of 0 (no payload). Is there something else I need to do?