Fork me on GitHub
#re-frame
<
2016-01-07
>
peterbak03:01:06

inside (re-frame/register-sub) is it ok to use (subscribe [:blahblah]) to link one subscription to another?

peterbak03:01:30

actually, just answered my own question by looking at code in re-frame-stiching-together repo

mbertheau09:01:47

@peterbak but don't subscribe inside the reaction, do it outside instead.

hugobessaa10:01:52

re-frame is so elegant. I could read the entire source in about 30 minutes, understanding how everything works behind the curtains.

hugobessaa10:01:07

comments are a big plus, helped a lot.

hugobessaa10:01:03

also learned some tricks, like lazily using multiple atoms to simplify implementation (https://github.com/Day8/re-frame/blob/master/src/re_frame/undo.cljs#L27-L31)

hugobessaa10:01:11

thanks 😄

hugobessaa10:01:19

I'll start using re-frame at a work project

joshkh15:01:07

re-frame is pretty fantastic and i've really enjoyed learning it thus far! just a quick best practices question: is it better to end a handler function by calling (dispatch [:some-second-event]) which in turn invokes a second handler, or should a single handler attempt to mutate app-db as much as possible in one go? i'm a bit worried that long chains of dispatches will become hard to keep track of when an application reaches a certain size, yet i see the value in small, testable, handlers that do their specific job and then dispatch to another event.

mikethompson16:01:06

@hugobessaa: @rodeorockstar it is very nice to get such positive feedback. Thanks.

mikethompson16:01:53

@rodeorockstar: you shouldn't think of dispatch as acting like a function call. It really should be used to represent a genuine event

mikethompson16:01:58

So what you probably want to do is to factor out the functions you want to call in the service of event handlers, and then simply call them from within the event handler

joshkh16:01:39

makes sense simple_smile

mikethompson16:01:31

BTW, everyone .... when writing complicated event handlers you might find synthread useful

mikethompson16:01:25

(But only useful if your event handers really are quite complicated, and most are not)

peterbak18:01:23

that synthread video is blowing my mind. "keep on threading".

peterbak19:01:14

one of the most useful things to come out of that video, for me, is the built-in as-> macro that I just used for the first time ever. Clojure(Script) never gets boring.

surreal.analysis19:01:39

My biggest issue with things like as-> are that they are so hard to google for

surreal.analysis19:01:44

Then I remember http://conj.io/ and can finally find it

peterbak19:01:21

good point. I find http://clojuredocs.org/ very useful for things like that