Fork me on GitHub
#re-frame
<
2016-05-18
>
lewix04:05:58

why is that the global atom not in a closure so that it doesnt polute the global state

lewix04:05:13

thank you for the invite @danielcompton

danielcompton04:05:43

Good question!

danielcompton04:05:22

It could be in a closure, but then everything in the whole app would need to pass that closure around to be able to have a reference to it in handlers, subscriptions, e.t.c.

danielcompton04:05:29

It’s a pragmatic tradeoff. There is a small amount of global state, but it makes developing apps much easier

danielcompton04:05:50

re-frame was designed for SPA’s so there is only ever one app running in the browser at one time

danielcompton04:05:16

If you wanted to run multiple apps side by side then it wouldn’t work out of the box, or you’d need to do some funky binding stuff

danielcompton04:05:08

We’ve had thoughts about handling global state, reusability of re-frame components, e.t.c., so the approach taken might change one day (with a backwards compatible migration path, i.e. copy the closure state back into global atoms so re-frame continues to function normally)

lewix04:05:11

that's how redux/ does it...

symbit14:05:13

@danielcompton: it turns out the users are using Chrome. Phew.

jamesmintram20:05:32

Hi Guys - I wondered if there was a sample somewhere using re-frame (bigger than TodoMVC) - that would allow me to get my head around how I would structure my data? The key hangup I am finding - is how to go about interspersing UI related data with Model data. A good example is a tree of data that I would like to display. The UI related parts are - Is the node collapsed or open - the Model parts are “What are my attributes” and “What do my children contain”. It doesnt feel right polluting the Model state with UI state.

jamesmintram21:05:21

Thanks! Didn’t see that page 🙂

shaun-mahood21:05:06

@jamesmintram: It's one of the few projects that has the problem of too much good documentation and info 🙂

lewix21:05:52

really? that's what you call too much good documentation and info in the clojureworld? it's worrisome

roberto21:05:01

it is pretty well documented

lewix21:05:20

but I expected it to be the norm

fasiha21:05:36

@jamesmintram: I keep my "model-related data" under one path of app-db, and then all the view stuff in another. My apps have less links between the model and the views than your collapsable tree example, which might need to have the same structures in both model and view sub-maps of app-db?

shaun-mahood21:05:41

@lewix: Not in the clojure world, I actually found re-frames documentation better and easier to understand (for me) than many resources from other languages and fields, including a university education and everything contained therein and many of the programming books I've read targeting other languages and fields.

roberto21:05:11

i think every lang community has the problem of poor docs

roberto21:05:38

i’ve experienced that pain with javascript, ruby, python, java, scala, clojure

lewix21:05:41

@shaun-mahood: let's agree to disagree

shaun-mahood21:05:59

@lewix: And if you have examples that are of a similar quality and scope, I would actually be very interested to look at them. I've found writing my own documentation hits a spot between technical knowledge and writing ability that is pretty sorely lacking.

lewix21:05:08

redux for one

shaun-mahood21:05:48

Really? I'm totally going to check it out then!

roberto21:05:50

do you say that because is of the way it is formatted or the content?

roberto21:05:30

i have to agree that re-frame’s docs can be better formatted for easier navigation

roberto21:05:34

instead of using github wiki

roberto21:05:40

that is not so friendly

roberto21:05:01

but content wise, it is really good

lewix21:05:10

re-frame doc seems scattered all over the places

lewix21:05:46

I'm happy that there's enough good content to learn efficiently - I'm not complaining

roberto21:05:49

how about cider, would you consider this bad docs? https://cider.readthedocs.io/en/latest/

lewix21:05:03

@roberto: I don't know. I'll have to experience it - trying to find info, etc. before I give my pov

lewix21:05:53

I consider re-frame doc satisfying as opposed to excellent

lewix21:05:45

The fact that it's considered excellent for the community get me a lil bit worried for the other libs

roberto21:05:58

for a front-end library, I was able to get started just be browsing through the Readme.

roberto21:05:13

haven’t been able to do that with any other front end framework of that magnitude

roberto21:05:23

also, in clojure, most libs are very small

roberto21:05:40

how much docs do you need for a simple xhr library?

fasiha21:05:43

I think the re-frame README gives you an intellectual skeleton that, once you've worked through a couple of examples and see how db-subs-views-handlers interact, you can look back on and go "Ahh, it all makes sense". It takes a good amount of experimentation with re-frame for that moment to come, and there's nowhere in the docs "here's how we'd set up a simple app from scratch".

fasiha21:05:07

Comparing re-frame docs to redux's, which Dan Abramov & Facebook friends work on full-time, is a little unfair.

roberto21:05:41

yeah, starting from scratch would be challenging, I think most people that use re-frame have had prior experience with reagent and cljs

lewix21:05:45

@fasiha: the doc was excellent before he started working on it fulltime

lewix21:05:37

and he's definitely not working on it full time

roberto21:05:18

i think it is probably just the way most people in clojure-land approach building something: with very small incremental steps, seldom people start with re-frame.

roberto21:05:51

also, consider the original purpose of redux

fasiha21:05:52

@lewix: but you see what I'm saying—Facebook opening some source code is a corporate release. @mikethompson I don't think is representing his employer in the re-frame README. I am much much more picky about my work when it's Real Work versus an internet project.

roberto21:05:56

it needed good docs

lewix21:05:15

@fasiha: no I don't. facebook hired him recently

lewix21:05:26

@fasiha: it was always a side project

roberto21:05:41

the original purpose of redux was for a presentation, so it inherently required to be well documented. The process of writing it was to explain a concept.

lewix21:05:06

I disagree guys. I think credit goes where credit is due- his docs are excellent

roberto21:05:20

yes, his docs are good, we are not debating that

fasiha21:05:51

The broader issue that @lewix raises is legit I think—I would agree that the JS community generally makes more approachable, less cogitation-intensive, and generally "better" docs than Clojure

fasiha21:05:49

Not sure if it's a language issue or what—at my point, having "gotten" re-frame to some extent, the thought of trying to explain it to a node (non-react) or JVM Clojure dev walking into cljs is frightening and daunting

roberto21:05:58

i would disagree there, I’ve had to work with some libraries that have gnarly docs

fasiha21:05:31

I'm thinking of rethinkdb, lodash, d3, node, etc.

roberto21:05:01

do you remember the first docs for lodash?

fasiha21:05:20

No idea how old lodash was when I started sorry 😛

roberto21:05:22

even angular, their docs were awful, plentiful but bad

roberto21:05:34

they slowly got better

lewix21:05:08

I think that the clojure world has a problem with "getting started" in general; the transition from beginner to intermediate can be daunting, and the docs are a byproduct of that. The educational materials and the libs are all scattered, it doesn't sound like there are a strong consensus on the best practices or the best tools. You are expected to glue the pieces by yourself - I believe that's what projects like arachne are attempting to solve

roberto21:05:07

yes, barrier to entry is pretty high

roberto21:05:34

but once it clicks, it is hard to do anything else

roberto21:05:56

or to at least enjoy anything else

fasiha21:05:57

Well, @roberto, I wonder if there's a cultural element too—Elm has a huge barrier to entry but man, those docs, those error messages, those curated libs…!

roberto21:05:23

yes, Elm focuses a lot in the developer experience

fasiha21:05:30

Evan made it a priority to make Elm attractive to mainstream front-end devs, and it shows…

roberto21:05:32

that is a priority for Evan

lewix21:05:48

@fasiha: I wish Elm was a bit more mature. I would have definitely turned my focus to Elm

fasiha21:05:13

Clojure is a much bigger beast than Elm is now. I cannot wait to see what Elm and ClojureScript/re-frame/posh/om next look like in 1–2 years.

roberto21:05:16

if I hadn’t been bitten by the lisp bug, I would be doing Elm

roberto21:05:22

but I think Elm and Cljs are now light years ahead of js. Javascript is adapting the concepts in Elm and cljs, but for the most part, if you chose Elm or cljs, you are conciously deciding to be in the bleeding edge

roberto21:05:28

which means you will get cut alot

underplank21:05:09

Hi all, Im trying to workout how do do navigation is re-natal (re-frame in react-native.)

underplank21:05:50

THe issue is that when I update the db using a dispatch from the figwheel repl the app-root function doesnt get re-rendered.

underplank21:05:12

Is this because its not returning a component directly?

roberto21:05:17

should this return a function (get routing @route) ?

underplank21:05:46

thats the intention, as it then gets executed. I messed around and bit and somehow seemed to get it to work… sooo yeah.