Fork me on GitHub
#keechma
<
2017-04-14
>
urbank20:04:19

Hello! I'm unclear when the subscriptions get rerun? Do all subscriptions run on every render?

mihaelkonjevic20:04:12

@urbank so that part is up to reagent, since keechma is using reagent’s reactions for subscriptions. Here’s an excerpt from http://reagent-project.github.io/news/news060-alpha.html Reactions, i.e cursor called with a function, reagent.ratom/reaction, reagent.ratom/run! and reagent.ratom/make-reaction are now lazy and executed asynchronously. Previously, reactions used to execute immediately whenever the atoms they depended on changed.

mihaelkonjevic20:04:05

what do you want to achieve?

urbank20:04:52

Hm, I see. Well I have a big list of components, which are all editable. The parent component has a subscription which fetches the ids of the items, and the child components each have a subscription which returns the entity with that id

urbank20:04:35

However, when I edit one of the child components, the top level subscription executes, and rerenders the whole thing

urbank20:04:13

the child components edit themselves via ui/send-command

mihaelkonjevic20:04:44

ok, so I guess that child component has some kind of “editing” local state?

mihaelkonjevic20:04:01

which gets overridden on each re-reneder?

mihaelkonjevic20:04:45

so, I don’t think that the parent component should be re-rendered if the id list is not changed

mihaelkonjevic20:04:02

is it possible that the child component re-renders when you update the item?

mihaelkonjevic20:04:31

if you parent subscription returns the list of objects (for instance if you use the entity db collection) then it would re-render - because the item in the list changed

urbank20:04:13

>if you parent subscription returns the list of objects (for instance if you use the entity db collection) then it would re-render - because the item in the list changed

urbank20:04:21

I think this is the issue

mihaelkonjevic20:04:52

the easiest way to fix it is to just map over the collection and return ids (map :id entity-db-collection)

urbank20:04:13

Right, thanks! I'll try that

mihaelkonjevic20:04:56

no problem. How do you like Keechma so far?

urbank21:04:09

@mihaelkonjevic It seems very promising! Was mostly concerned about this issue with rerendering, but you cleared that up just now. I like the idea of multiple keechma apps running at the same time, because that's something I've been dealing with lately.

urbank21:04:28

I also big fan of the idea components declare their dependencies, so that you don't have to deal with long argument lists

mihaelkonjevic21:04:16

awesome, please reach out if you have any questions, I’m always monitoring this channel 🙂

urbank21:04:34

Thanks! I'm still evaluating what to use for a big rewrite, and keechma is high on the list 🙂

urbank21:04:57

Haha, I realized that I mostly just regurgitated what's written on your website. As I test more, I'll try to come up with more useful feedback 🙂

mihaelkonjevic21:04:02

cool. I’m also working on release of https://github.com/keechma/keechma-toolbox which should provide a lot of convenience stuff for keechma. It’s a lib that’s extracted from our production code, but thorough testing and docs are missing. Here is a very rough draft of the blog post about the pipelines which make working with async actions in controller much easier https://gist.github.com/retro/35ef04d42a6c6265ee140dacdf0777df

mihaelkonjevic21:04:46

I hope to release it this weekend or early next week, so take that into account when making a decision 😉

urbank21:04:13

Thanks, will check it out! The decision is not exactly imminent... still a lot of work supporting the current version, so time for more longterm things is a bit short 😉