Fork me on GitHub

@petrus: you can do either


The subtlety is: the component in which you do the dereference will be the component that gets rerendered when the subscription value changes.


If that rerendered component then passes updated values (from the dereference) into further child components, then they too will then be rerendered (because their props - aka parameters) changed.


This subtlety will likely be irrelevant to you, so don't sweat it too much if the above reads like double dutch.

braai engineer08:06:40

@mikethompson: makes sense. I was worried about the rendering, yes. It feels cleaner to pass values to components, but if the root component does the deref, everything will re-render needlessly, right?


Yes, corrrect.


@petrus, @mikethompson would wrapping passed values in reaction prevent triggering rerender?


ok, that was stupid...

braai engineer10:06:07

Can you call a go routine inside a re-frame handler?


You can have a go-loop if that's what you mean

braai engineer10:06:01

Inside the go-loop I'm doing a web request with cljs-http and when the results comes back, I want to update app-state. Should I then dispatch another event with the new, parsed data?


But remember two things: - the normal purpose of a re-frame event handler is to provide a modified version of app-db. So this event handler, containing the go-loop will still need to return db (perhaps not modified) - the go-loop will out-live the event handler itself. When this loop wishes to emit events, it should dispatch them.

braai engineer10:06:31

Great, that's what I ended up doing.

braai engineer10:06:42

should I use register-base or one of the less pure event handlers?


You should never need to use register-base

braai engineer11:06:56

Any good pagination stories for filtering long lists with re-frame and advancing pagination by scrolling?

braai engineer11:06:39

I've followed the examples that use reactions to filter, but implementing discourse-style "infinite scrolling" seems like a lot more work.

braai engineer11:06:35

Secondly, where is the right place to manage periodic polling on certain screens when using re-frame? Should I tap into dismount events for root components to stop polling?


@petrus: regarding polling, you mean you want to setup polling only if a given page/component is mounted?


@petrus: you would probably have to go with full blown component with will-mount and will-unmount to setup and bring down polling respectively

braai engineer13:06:52

I guess I could do some of the tearup and teardown in navigation dispatches


@petrus: that feels a bit fragile to me, but maybe it could be done reliably that way - you could dispatch events that would trigger polling on certain actions

braai engineer13:06:36

What's a clean way to deal with loading of data in re-frame when the URL route references an entity that isn't available yet?

braai engineer13:06:30

Hm, nevermind, I think I answered my own question simple_smile


is it possible to use native react mixin in reagent component?