Fork me on GitHub
#re-frame
<
2017-02-10
>
escherize00:02:36

also the recommended practice is "don't do that"

kauko09:02:06

@negaduck I believe you shouldn't do that since "Only these things are true" is not really something you find in mathematical logic

kauko09:02:10

I could be wrong though

negaduck09:02:46

@escherize, @kauko, could you explain why it’s not a good practice? I can imagine a case when it catches a bug:

(re-frame/reg-event-db
 :set-active-panel
 [check-spec-interceptor]
 (fn [db [_ active-panel]]
   (assoc db :active-panel active-panel)))
If there is a typo in the last line like (assoc db :actvie-penal active-panel), the map now has a key that is irrelevant to anything, user clicks a button and nothing happens, and this typo is hard to find.

kauko09:02:36

In that case, check that it has :active-panel

kauko09:02:05

Or if you do a dissoc, then you have to check that those exact keys are not in the result

kauko09:02:35

Ohh you mean that the key is already in there

kauko09:02:39

My bad, I misunderstood

negaduck09:02:53

@kauko, yes, it now has both :active-panel and :actvie-penal

kauko09:02:18

Yeah you're absolutely right I think. I just remember Hickey mentioning in his clojureconf talk that clojure.spec doesn't have that concept, because mathematical logic doesn't. Maybe someone who knows more about maths can explain what the repercussions of such a concept would be

kauko09:02:32

I was initially a bit disappointed by that claim, but when I thought about it more, the only times I could think of when I'd want to do a check like that, was typos

kauko09:02:33

like you said

kauko09:02:13

So if there's a trade off to adding that concept, maybe it's not worth it

kauko09:02:47

If you really want to know, I'm sure there's discussion about this in the google group. 🙂 OR you can just carry on doing what you want 😄

negaduck09:02:48

I would like to see that discussion. Anyway, we can have spec for values: (s/def ::active-panel #{:home-panel :about-panel}), why not have a spec for keys? (s/def ::good-state (only-keys :req-un [::active-panel]))

scknkkrer14:02:54

Guys i have a question; I have a project like cms admin panel. How should organize files, like this ? https://github.com/Day8/re-frame/blob/master/docs/Basic-App-Structure.md#larger-apps Or something different structure ?

scknkkrer14:02:52

Anyone have one example project that use re-frame ?

gregnwosu19:02:51

hello i have a silly question but how does one call the server side from reagent?

samueldev19:02:11

@gregnwosu using any of a myriad of ajax libraries

samueldev19:02:27

cljs-ajax, cljs-http

gregnwosu19:02:18

i’ll take a look now thanks,

gregnwosu19:02:42

so you have to standup a seperate service?

stephentriphahn19:02:21

@gregnwosu yes there will need to be some type of service endpoint to hit, what exactly are you trying to do?

gregnwosu19:02:20

just learning the paradigm im hoping to stand up a service that analyses some text

gregnwosu19:02:37

so a user logs in , enters text into a text box and the text is analysed

gregnwosu19:02:52

the analysis should take place on the serverside

gregnwosu19:02:05

so I will need to send the text over ajax to the processing server

gregnwosu19:02:40

and then return the result

stephentriphahn19:02:58

got ya, I’ve had success setting up some server side code in a re-frame application using Ring/Compojure, which is pretty simple to set up, I’ll find you the docs I used

gregnwosu19:02:03

the text may take a while to process so it will need to be added to a processing queue

gregnwosu19:02:14

thanks thats awesome

gregnwosu19:02:57

I looked at reframe but i was a bit overloaded , i wanted to get my head around reagent first, which i think i have now, so please hit me with the reframe doc

stephentriphahn19:02:32

This should give you a good idea and I think it is just using reagent

gregnwosu19:02:52

cool , did you have a reframe doc too?

shader21:02:31

how would you use the following js lib with re-frame? http://davidshimjs.github.io/qrcodejs/

shader21:02:27

I'm just not sure how passing in the element works, since it will probably be executed before the markup around it is mounted