Hello! I'm unclear when the subscriptions get rerun? Do all subscriptions run on every render?
@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.
what do you want to achieve?
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
However, when I edit one of the child components, the top level subscription executes, and rerenders the whole thing
the child components edit themselves via ui/send-command
ok, so I guess that child component has some kind of “editing” local state?
which gets overridden on each re-reneder?
so, I don’t think that the parent component should be re-rendered if the id list is not changed
is it possible that the child component re-renders when you update the item?
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
>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
right
I think this is the issue
silly me
the easiest way to fix it is to just map over the collection and return ids (map :id entity-db-collection)
Right, thanks! I'll try that
no problem. How do you like Keechma so far?
@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.
I also big fan of the idea components declare their dependencies, so that you don't have to deal with long argument lists
awesome, please reach out if you have any questions, I’m always monitoring this channel 🙂
Thanks! I'm still evaluating what to use for a big rewrite, and keechma is high on the list 🙂
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 🙂
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
I hope to release it this weekend or early next week, so take that into account when making a decision 😉
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 😉