Fork me on GitHub
#re-frame
<
2017-09-01
>
caleb.macdonaldblack01:09:35

Can subscriptions have logic in them and query the data from the app db, or should the event set all the properties my view needs and just have simple subscription with no logic?

danielneal08:09:59

Yeah - it's totally fine (even recommended) to have logic in the subscriptions. They are cached. One point to watch out for is to separate out "layer-1" subscriptions which just extract from the db and "layer-2" subscriptions which take "layer-1" subscriptions as input and do (possibly more expensive) calculations with them

danielneal08:09:12

^ I might have got my layer numbers wrong but that's the basic idea

caleb.macdonaldblack00:09:03

Thanks, I had no idea subscriptions worked this way. :thumbsup:

genekim04:09:16

I have a question about the best practices around the events.cljs — all my events are currently in that file, 250 lines of it… Any opinions on splitting this file up by component or functional areas? Thx!

sandbags09:09:56

@genekim as far as i can tell it's a matter of preference, either way will work applied consitently

jvuillermet10:09:02

just watched this talk yesterday https://www.youtube.com/watch?v=XpDsk374LDE I think a lot of it applies in re-frame @genekim

genekim16:09:56

oh, that’s so cool, @jvuillermet! Watched the first five minutes — looks fascinating. And of course, awesome to hear the creator of Elm speak, too!

genekim16:09:23

Thx for opinion, @sandbags — I think it means “full speed ahead” on trying to split the file up. 🙂

aj taylor17:09:38

@genekim I loved reading your book! Awesome to see that you enjoy re-frame as well 🙂

genekim20:09:15

@aj Haha. Thanks for the kind words! And am just blown away at how great re-frame and clojurescript are!

gjnoonan20:09:20

@genekim what are you working on for your first app, are you able to say?

genekim20:09:39

@gjnoonan It’s a rewrite of https://tweetscriber-app.herokuapp.com/. It’s one of my most used apps, especially at conferences, which allow me to take notes and tweet at the same time, which turns out to be surprisingly useful for writing books. (Makes note-taking more fun, and allows me to save and find all my notes later.) Original version we did in Objective-C, about 2000 lines of code. TypeScript/React port was about 1000 lines of code. CLJS/re-frame port is probably half that again (not yet running in production, but soon! 🙂 Biggest difference: things I’ve wanted to add to TypeScript version just sat for months, because the code I wrote is such a mess… In contrast, everything seems so easy to implement in ClojureScript/re-frame!

gjnoonan20:09:00

That does seem like a useful app!

gjnoonan20:09:02

I have to touch some TypeScript codebases on occasion, so I know exactly what you mean 🙂

genekim20:09:03

(PS: to be clear, TypeScript is so much safer for me than JavaScript, because I’m such a lousy programmer. It’d be infinitely worse without TypeScript, static type checking, etc… :) @gjnoonan

gjnoonan20:09:19

@genekim Ha I get that, I am a fan of typed languages and the benefits a compiler and type system bring, I think TS is better than JS--and for large codebases and onboarding new team members it is good. It's jut my heart is In Clojure/ClojureScript (hence why I created this community) and I find it hard to write anything else without yearning for them 😆

mheld23:09:35

has anybody here used sodium?

mheld23:09:43

trying to get past the install and I'm getting hung up on java.lang.ExceptionInInitializerError, compiling:(sodium/macros.clj:1:1)