Fork me on GitHub
#re-frame
<
2016-01-21
>
frank01:01:11

this is awesome!

mbertheau08:01:32

@peterbak @colin.yates : In https://github.com/yatesco/re-frame-stiching-together/blob/2d4363b31da630ac170035ec215c0164bf874a4d/src/cljs/demo/views.cljs#L151 won't the subscriptions be re-done on each change to the temperatures or id->fruit ratom? They are derefed outside of the final reaction that is the result of the subscription function. Or maybe I still don't understand how reactions work.

hugobessaa10:01:21

@sooheon: your link do not work

hugobessaa10:01:06

@sooheon: how are you calling panels when the url changes?

sooheon11:01:19

@hugobessaa: Hey thank you, I realised that my problem was using a form-2 function without also sending the argument to the inner function. In the fractalify codebase, actually it seems that he sent the args to just the inner fn, while re-frame docs recommend supplying to both. Both ways seem to work in my app—is there a practical difference?

hugobessaa12:01:05

AFAIK you need to keep them with the same arity

kauko13:01:57

Actually I don't think they need to be the same arity. The "outer function" just holds the initial values, and the inner render function will hold the values that are updated by react

kauko13:01:19

That's why if you forget to repeat the arguments, the component will never seem to update

kauko13:01:25

because you're actually using the initial values

kauko13:01:06

I guess if you don't define the parameters for the outer function, the component just won't get any initial values? No reason to really do that though

kauko13:01:31

I'm just guessing though. I thought both of them need to have the same arity. 😛

mbertheau16:01:29

How much of a problem is it to subscribe in a form-1 component that has arguments?

mbertheau16:01:16

As far as I understand that means that the subscribe code is executed each time the component is re-rendered, instead of just using the reactions these subscriptions return. However I don't know how big a performance impact that really is.

mbertheau16:01:41

On our page every keystroke leads to around 100ms of JS activity in the profiler.

hugobessaa18:01:33

subscribe returns a ratom. You will want to subscribe once and let reagent do it's magic to just render your components when that ratom value changes. See https://github.com/reagent-project/reagent#examples. It superficially explains how form-2 works

shaym19:01:45

are there any viable solutions for 2-way syncing the local data store with the server?

peterbak20:01:26

that's a million dollar question

jaen20:01:39

Om.next is the closest thing to that. I've also remember dato and posh in that general niche. I'm also doing something like that, but not in the open ATM.

shaym20:01:04

i am also writing a solution but my gut tells me that i am reinventing the wheel at numerous places

shaym20:01:35

@jaen: looks like posh is only client side , dato looks good but doesnt seem ready

jaen20:01:04

Hmm, yeah, it seems posh is only client-side indeed. Om.next is ATM the most advanced solution. I recall the maintainer mentioning that the synchronisation part can be used separately from the DOM part, but I didn't yet have any time to look into that.

jakemcc22:01:17

@shaym I’ve done that using http://firebase.com as the backend data store and kept it in sync with a local ratom. Worked pretty well for building some basic multiplayer (2-6 player) turn based games