NodeView - know when pos changes?

It looks like there’s no way for a node-view to be notified when there’s a change to the node’s pos, is that right?

The reason I’d like this is to avoid unnecessary re-computes of a ResolvedPos.

If not I can always cache the old value and check getPos for a change before reusing.


What is your node view doing, that it even executes any code on document updates?

I’m not sure I understand the question.

My guess is you’re thinking maybe I am performing some kind of document modification in update, which would indeed be bizarre. I’m not. The nodeview exposes some UI for interacting with the document, and it seems like a shame to keep recomputing resolved nodes when nothing has changed.

It’s definitely not a big deal. Was just curious if there was a way to know if the position (as opposed to the type/attrs/content) of the node had changed.

If this is a user-initiated thing, definitely just call getPos when it happens. There should be absolutely no issue with that.