What can cause a NodeView to be rebuilt?

I have a node-with internal state that was frequently getting lost, which turned out to be because the view was being destroyed and re-created, even though no edit was made to the document node (and .update was definitely not called)

After some tracing I’ve found that just removing a dynamic class update from a DOM node in the view was enough to remove these unexpected re-creates.

Any ideas on why this might be happening? I’m stumped.

You are not using Yjs? Are you using ignoreMutation in your NodeView? Check that you are ignoring changes done inside your contentDOM eg !this.contentDOM.contains(mutation.target)

Thanks! Adding ignoreMutation fixed the issue. I would have thought PM would automatically ignore mutations outside the contentDOM, but I guess not?

1 Like