Fork me on GitHub
#re-frame
<
2017-09-18
>
l1sp3r08:09:40

so another question, I want to dispatch an event when a local atom changes, is putting a (run! (dispatch @atom)) in a form-2 component bad form?

curlyfry10:09:35

@l1sp3r Why do you have the wrapping run? And when does the local atom change?

lxsameer11:09:46

@mikethompson hi, did you look at the PR for gitbook integration ?

l1sp3r12:09:37

@curlyfry local atom changes when user inputs to a text field.

manutter5112:09:43

@l1sp3r Personally I’d be more likely to set things up so that the original update event would dispatch two events, one to update the local atom, and the second to be whatever event you want to fire when the local atom changes

manutter5112:09:33

but perhaps I’m not understanding your use case here.

daiyi12:09:26

hey @lxsameer! I've also been musing over gitbook integration but haven't felt bold enough to pull the trigger on putting in a PR :P cheers!

daiyi12:09:54

(I spent a while trying to format chapters nicely and eventually put it aside because it was taking quite a while to make it polished enough such that I felt happy with it. the search and overview functionality alone is pretty awesome though! I'm down to put more time into it if people would use it (: )

daiyi12:09:29

I liked playing around with plugins that made overviewing and navigation nice, like I got super into these collapsing/uncollapsing subsections: https://inkwing.gitbooks.io/re-frame/content/MentalModelOmnibus.html#guiding-philosophy <---prototype

lxsameer12:09:40

@daiyi Cool, if @mikethompson and other people in charge of re-frame decided to go for it, we can work together on this

arulpugazh12:09:53

Hi, I'm trying to post a GraphQL query using re-frame-http-fx, but the server does not receive the params which is sent. Simple GET using cljs-ajax works though. Following works:

(GET "/graphql" {:params {"query"  "{user(id:\"100\") {first_name}}"}})
Following doesn't work, both :params and :query-params are not populated as seen by server:
(reg-event-fx
 :graphql-handler
 (fn [{:keys [db]} _]
   {    :http-xhrio {:method          :get
                     :uri             "/graphql"
                     :params           {"query"  "{user(id:\"100\") {first_name}}"}
                     :response-format (json-response-format {:keywords? true})
                     :on-success      [:good-http-result]
                     :on-failure      [:bad-http-result]}}))
I read the ajax-request api in cljs-ajax, but couldn't isolate the issue. What am I doing wrong?

souenzzo12:09:23

I think that you missed the :format (ajax/uri-request-format)

arulpugazh12:09:26

@souenzzo That solved it:) I tried with :format ajax/json-requestformat before but didn't try this . Excellent, thanks

mokr16:09:25

Hi, does anyone know of a websocket equivalent of the :http-xhrio above? That is, a library that provides an idiomatic fx-handler for websocket communication?

mike70657417:09:14

I haven't used it - I remember looking for one, then I decided to try making my own fx handler

mike70657417:09:56

I'm not an expert, so it's probably not idiomatic or very good

mokr19:09:12

@mike706574 Thanks, I’ll have a look.