NodeView rebuilt without update method called

I’ve noticed that a transaction that updates an attribute on a node that is ancestor to a node-view, can cause that node-view to be reconstructed with first calling the update method to see if the existing node-view can still be used.

Is that expected? Is there any way to avoid it (i.e. have update called)?


Yes, that is expected. If the parent gets redrawn, so will all its children.

In my case I am tracking some data in an attribute that has no impact on drawing the node. It there any way to avoid a redraw when updating this attribute? Or a better way to store the data? I guess I could associate it with the node using a weak-hash.

I think it would be possible to define a node view with an update method for the parent node. The default drawing strategy using toDOM doesn’t know anything about the relationship between the DOM and the node’s attributes, so it just always redraws.

1 Like