Fork me on GitHub
#re-frame
<
2017-04-13
>
qqq04:04:55

is I'm using re-com correctly, is it correct that I should not use any dom/hiccup-elems/div/spans

qqq04:04:00

and everything should be just pure rc.core components ?

qqq04:04:19

I heard something like this type of discipline is necessary for the layout flexbox stuff to work.

qqq04:04:39

So, we recommend you go 100% all-in on using h-box and v-box. If you do, everything should "just work".

Never mint your own container [:div] or [:span] unless you also give them the correct flex styles, which is arduous and error prone.
Ah, that's where I read it!

qqq05:04:30

@mikethompson : as a corollary, do we have "using tables for layout is a big NO NO in re-com " ?

mikethompson05:04:31

Obviously, you can plonk in whatever you want. canvas, tables, whatever ... all good ... you just have to be clear on how they will interact with flexbox.

mikethompson05:04:51

If you don't think it through, then you can get a surprise.

mikethompson05:04:11

Which is why it it is easier to just be 100% all in

qqq05:04:17

also, if I want an element that is: (1) normally displays as text (2) when I double click, becomes input text field (3) when mouse clicks outside the field, dispalsy like normal text again to do the above, do I use input-text and configure that -- or am I dynamically swapping input-text with label ?

qqq05:04:33

okay, I'll hold off on using tables until I actually understand (1) how flexbox css works and (2) how flexbox css is used in re-com

qqq05:04:50

so basically "if you're not smart enough to wrap the table div as a re-com component, don't use it" 🙂

mikethompson05:04:46

flexbox is something to learn, yes.

qqq05:04:22

for flexbox: any tutorials/books you recommend ?

mikethompson05:04:25

I'd say you are swapping a dov for an input-text, yes

qqq05:04:57

okay, so swap re-com.core/lbel with re-com.core/input-text ?

qqq05:04:31

actually, has anyone done a todo-mvc in re-com ?

qqq05:04:35

I can just copy from that instead of pestering you

mikethompson05:04:12

That tutorial link I gave above has some flexbox resources. But its been a while since I looked. I actually find the hbox page one of the best ways to understand flexbox, once you know the basics: http://re-demo.s3-website-ap-southeast-2.amazonaws.com/#/h-box Fully interactive

qqq05:04:45

I will look into that and rotate my head 90degs for the v-box one.

qqq05:04:01

how about re-com / todomvc? I see a number of re-frame/reagent todomvcs, but not any that are using re-com.

mikethompson05:04:29

the demo app itself is the best tutorial

mikethompson05:04:47

At the top of each page there are blue hyperlinks

mikethompson05:04:56

"component" and "page"

curlyfry05:04:56

@qqq If you like interactive tutorials, this one is pretty great: http://flexboxfroggy.com/

qqq06:04:59

@curlyfry : this is completely ridicilous but also precisely what I need

qqq06:04:50

it needs sound effects and batches

qqq07:04:51

for rc/input-text, if I specify an ratom for :model, why do I still have to specify a :on-change ?

mikethompson07:04:46

input-text only ever reads from the ratom-ish :model (which actually might be a reaction).

mikethompson07:04:09

It notices when it changes. But it never changes it.

mikethompson07:04:42

Hence the need for :on-change

mikethompson07:04:55

I don't believe in cursors :-)

qqq07:04:39

@mikethompson : okay, and this is the same for all :model attributes in re-com right? in that: 1. :model only reads from the atom 2. It's my job to update it via :on-change

qqq07:04:00

thanks, consistency is good enough 🙂

qqq07:04:13

maybe :model can be changed to :read-from 🙂

qqq07:04:16

it'd make it a bit clearer

mikethompson07:04:42

If you think about it, re-frame is much the same. The command path is separate from the query path.

mikethompson07:04:59

Nothing two way

mikethompson07:04:36

@qqq regarding name changes .... that boat has sailed :-)

idmit20:04:17

Hello, everyone. I've got a simple question: where is it best to put rand-int calls? Docs advise on making event handlers pure, but it seems like an overkill to make an effect handler for such a small thing.

mattly23:04:08

@idmit that sounds like something you'd put in a cofx

mattly23:04:28

but really I think it depends on how the randomness is being used by your setup

mattly23:04:13

I have a question about subscriptions that do computations, caching of their results, and whether they're used in a view:

mattly23:04:13

let's say I have an app with two tabs you can switch back and forth between; each has a view that uses a different subscription to perform a different calculation on the same data set

mattly23:04:27

I'm noticing that when I switch back and forth between the tabs, it

mattly23:04:36

s re-running the calculations each time

mattly23:04:06

instead of re-using the unchagned value from the subscription, from the last render of the tab

mattly23:04:44

I was under the impression that re-frame kept the results of subscriptions around so long as the underlying data doesn't change

mattly23:04:59

but I suspect that because the subscription isn't used temporarily that it discards it to save on memory

mattly23:04:06

does anyone know if that's the case?