Clojurians
#re-frame
<
2017-01-13
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

stuartrexking01:01:23

Can anyone tell me what the second argument to a query function is. The first is db, but the second is unclear. https://github.com/Day8/re-frame/blob/master/src/re_frame/subs.cljc#L149

stuartrexking02:01:35

I think I get it. It’s the query arguments, sent from the view.

mikethompson04:01:21

@stuartrexking You have it correct. When you do this (subscribe [:some :thing 42]) the function registered by reg-sub for :some will get that entire 3-vector as the 2nd parameter

mikethompson04:01:53

So you might have a subscription like (subscribe [:all-items-tagged "salacious"]) ... within the handler you need to access the entire query vector so you can construct the right materialized view.

stuartrexking04:01:46

@mikethompson Thanks.

minikomi06:01:24

https://github.com/Day8/re-frame/issues/266 I’ve re-thought my stance on this.. really, if people need to work around it, a conditional statement and a polyfill will do the job.

andre08:01:43

hi, https://github.com/flexsurfer/re-frisk is coming on electron and react native, someone interested?

dobladez12:01:02

@superstructor thanks! that works

elahti13:01:49

Is there any way of making the re-frame-tracer.core/tracer to print the duration of the fn call?

qqq20:01:22

when building SPAs, is there a way to change the browser URL without causeing a page reload?

qqq20:01:47

I want the URL to 'encode some state' for reloading the SPA at a particyular state.

qqq20:01:06

window history pushState

manutter5121:01:53

Should be able to do that with fragments: ->

gadfly36122:01:40

@qqq previously you were asking about a use case for client side routing ... now you have one :)

qqq22:01:55

@gadfly361 : indeed, if I had a time machine that let me talk to future-1-week me, I'd get so much done :slightly_smiling_face:

gadfly36122:01:56

Hahah :laughing: me too!

ska23:01:47

Good evening. Can someone please tell me, if this is still a valid approach to showing chartist graphs: https://gist.github.com/edwthomas/08482a18a4aaf8655dc80f29f15beeef

ska23:01:21

I am using this and it works mostly fine, just when initialising my app and programatically dispatching the event that would normally be a user click on a navigation item, my graphs always end up empty and their view function does not get called when the data arrives.

ska23:01:34

If I understand things correctly, my question boils down to: How can I call the chartist draw method, which requires an element to draw on, after rendering the view?

ska23:01:41

Or, if :component-did-mount is the right way, how do I pass it some parameters?

kishanov23:01:23

you can recall it in :component-did-update

ska23:01:11

@kishanov which seems to have a weird signature according to https://groups.google.com/forum/#!topic/clojurescript/5WWfXAf4EDI

ska23:01:31

I am passing in the data to plot in the chartist graph.

kishanov23:01:22

:component-did-update
       (fn [this]
         (let [[_ arg1 arg2] (reagent/argv this)]
           (re-frender-something arg1 arg2)))

kishanov23:01:44

this is how I generally use component-did-update: arg1 and arg2 would be positionally the same arguments that you pass to the definition of component via defn

ska23:01:05

Hm, this function does not get called at all.

ska23:01:20

Oh, it does get called, when the call to the view contains some arguments. Hang on, need to change some functions now. :slightly_smiling_face:

kishanov23:01:52

https://gadfly361.github.io/gadfly-blog/2016-10-22-d3-in-reagent.html - I guess this is a good explanation of how it can be done in general with js libs that should be udpated when new props arrive