Fork me on GitHub
#re-frame
<
2019-11-16
>
Pavel Klavík16:11:29

Hi, I am trying to understand a strange bug in my application. I am rendering a tree of components and the application allows to add or remove nodes. In db, each node has a unique id and I have them stored as map from ids to a map describing the node (and its children, etc.). Rendering just recursively displays the nodes. When I load the application and remove a node, the subscription for its parent is modified and the component of the node is not rendered correctly. But when I load the application, add a node and then remove the node, it will call rendering of the removed node (whose subscription returns nil), which throws an error. Basically what happens that both subscriptions for the node and its parent are updated, but due to some ordering first the node is rerendered (which throws an error) and then its parent would be rerendered, which would actually remove the node. Is there a way how I can specify/control the order in which the components are rerendered when their subscriptions change?

p-himik10:11:31

I don't think this should happen under normal circumstances. Is there an SSCCE?

Pavel Klavík12:11:10

No, I will probably rewrite the subscriptions quite a bit and if it does not help I will try to produce one.

Filipe Silva21:11:43

was a bit surprised by that, the reagent one is

Filipe Silva21:11:10

I suppose it might because of the disclaimer?

Filipe Silva21:11:12

> But this is NOT your normal, lean and minimal todomvc implementation, geared towards showing how easily re-frame can implement the challenge.