Fork me on GitHub
#re-frame
<
2016-12-12
>
seantempesta01:12:26

Thanks mike. I'll give it a shot.

seantempesta02:12:45

@mikethompson: Just to clarify, re-frame-async-flow uses events, not effects, in the dispatches? I think this is what tripped me up before. Starting up a stateful service is a side effect right? I’m okay with making everything event handlers if it’s just a semantic difference.

mikethompson02:12:04

event handlers compute the effects of an event. They return a decription of the required effects. A map of them. After that, it is up to the effect handlers to action these effects.

mikethompson02:12:08

The new docs in develop (including the README) are much better at explaining all this https://github.com/Day8/re-frame/blob/develop/README.md

paulb04:12:12

if you have app-db getter functions that are used by both event handlers and subscriptions, which namespace do you put them in?

shaun-mahood04:12:08

@paulb: I tend to put them in my db namespace

paulb04:12:58

makes sense, thanks

mikethompson06:12:02

Inspired by @andre, I have tried to find a way to diagram aspects of re-frame (so far just event handling). These will end up in the docs. Open for comment. Be kind

mikethompson06:12:35

Hmm. I thought I get a white background by default. Not grey. That screws things up.

mikethompson06:12:36

Will provide again. I'll delete that attempt for now.

akiroz06:12:40

let's make an interactive diagram for re-frame in re-frame xD

andre06:12:34

@akiroz that was my initial idea 🙂

andre07:12:52

this is not diagrams , this is art, i can't do so 🙂

mikethompson07:12:16

I've been teaching myself Figma

mikethompson07:12:22

And I copied your ideas :-)

mikethompson07:12:43

But I live too much in the bubble to know if this really works

mikethompson07:12:56

Does you eye "flow" over the material?

mikethompson07:12:10

Or is it a dense slog

mikethompson07:12:46

Where I could, I tried to make it a top left to bottom right kinda flow

cmal07:12:13

@andre awesome! That would be very helpful.

andre09:12:13

hi all. please look at the screenshot

andre09:12:03

now you can learn re-frame in the re-frisk, maybe you'll have comments

ricardo10:12:14

@mikethompson I am liking the graphs. Please keep it up.

mikethompson10:12:23

I'm curious to hear from those new-ish to re-frame. Do the new diagrams help?

mikethompson10:12:39

(when read in conjunction with new docs in develop)

mikethompson10:12:52

Anything that worked, or didn't work?

andre10:12:23

i think they should be near the text, for me it's hard to understand thread only looking on the pictures

manutter5113:12:25

Hey all, I’m hoping someone can help me find a URL. I remember reading a blog post or something recently that described using spec to ensure that the app was always in a consistent valid state. It set up specs for all the data in the db, and then wrote a custom dispatch function to use spec to validate the db after every dispatch. Or something along those lines. Does that ring a bell with anybody?

djjolicoeur13:12:25

I happen to be going through to todomvc exaxmple, and they do it in there: https://github.com/Day8/re-frame/tree/master/examples/todomvc

djjolicoeur13:12:38

spec is in db and validation is in events

manutter5113:12:16

aha, the examples! I’ve read thru the docs and the faqs about three times thinking I was somehow skimming over it. Thanks much

danielgrosse13:12:11

Is it possible to make a function reactive? I want to have it rerunning, whenever a given atom changes

andre13:12:17

use reaction macros

danielgrosse14:12:40

(defn reactive-fn [atom]
(let [value (reaction atom)
(println @value))

andre14:12:50

(def ratm (reaction (reactive-fn @atom)))

andre14:12:46

(reactive-fn @atom) will be rerunning when atom changes

andre14:12:35

(defn reactive-fn [atom]
(println atom))

andre14:12:40

but, better to watch atom and call the function

manutter5114:12:06

I just went over the todomvc example, and it does define a spec for the app db, however that’s not the blog post I was thinking of. The one I’m looking for had a more detailed discussion/tutorial about setting up the spec for the app db and then writing a custom dispatch function so it would check the db on every reframe event dispatch

timgilbert15:12:15

@seantempesta: I've been hacking on re-frame / datascript / posh some: https://github.com/timgilbert/haunting-refrain-posh

timgilbert15:12:33

I've been meaning to blog about it but don't have time

timgilbert15:12:08

The version on develop is just storing a datascript conn object in the app-db which seems less than ideal

timgilbert15:12:05

...and I wind up needing to deref the posh connection one more time than I expected. It does work though, in the sense that you transact data to the conn and the correct components rerender

timgilbert15:12:45

I have a branch feature/datascript-coeffect in which I'm attempting to use a datascript conn as a coeffect instead. The code seems cleaner in some ways but I haven't managed to get the actual transact data -&gt; re-render bit to work yet

jhund16:12:56

@mikethompson the diagram looks fantastic! I find it very helpful in understanding what’s going on. Some background: I’ve been dancing with re-frame for about 6 months, read the original readme two times (loved it), have been stalking this slack channel and soak up everything related to re-frame. I am chomping at the bit to start building an ambitious app using re-frame as soon as I finish the current project. I’m super impressed with the interceptors chain. A very powerful concept. Seeing it in the diagram increased my clarity and intuitive understanding of the concepts involved. I had some gaps in understanding the function arguments (what gets passed into what handler). The diagrams helped a lot.

jhund16:12:03

I also read through the new Readme in the dev branch. It is a lot shorter and doesn’t seem to have as much character as the original readme. Maybe a good thing to keep it shorter to lower barrier of entry (if that is what you want at this stage of the project ;-)

jhund16:12:37

thank you so much for this fantastic framework! It gets me excited about front end dev again. I’ve stayed away from it and focused on server side for the last 5 years.

curlyfry16:12:40

@danielgrosse Sounds a lot like the new reagent.core/track function: https://reagent-project.github.io/news/news060-alpha.html I haven't seen a need for something like that since I have re-frame, what is your use case?

danielcompton21:12:37

Yeah, I agree with @curlyfry, if you're in the re-frame context, then using a subscription is probably your best bet, also, re-frame can do subscription deduplication and other cool stuff for you