Fork me on GitHub
#re-frame
<
2017-06-27
>
manutter5100:06:58

I think if you move your @ from the let down into the :value (:testfield @formdata) it should work

fabrao01:06:40

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 "")}))
?

madstap02:06:57

@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.

fabrao02:06:30

ok, thanks

danielneal11:06:55

can you access the current db from an effectful handler registered with reg-fx

danielneal12:06:32

(will be useful for writing stub handlers that write/read to the db instead of performing side effects)

danielneal12:06:54

and other things

mikethompson12:06:24

@danieleneal effects handlers are only get given (as a parameter) the data associated with their key

mikethompson12:06:31

Remember that an interceptor's :after fn can modify db. Not sure if that helps.

danielneal12:06:21

mmm thanks yeah, I've been using interceptors sometimes and effects handlers in other times,

danielneal12:06:44

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

danielneal12:06:13

I'm still at that newbie stage where I'm figuring out when it is appropriate to use which abstraction

souenzzo14:06:21

@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) )

danielneal14:06:34

ah I see 🙂 just add another layer!

nidu17:06:46

Hello. Question about re-com: is it possible in current single-dropdown to render html in primary input (not in options)?

pandeiro19:06:17

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?

pandeiro19:06:13

Ah, nvm, so I needed to use (ajax.core/json-request-format) to produce a map for that :format value; the :json shorthand didn't seem to work

gregg23:06:25

@nidu you can render html using the :placeholder argument but that will only last until a selection is made