In my app, I have a NodeSpec with
attrs: {
id: {default: 'id'},
lang: {default: ''},
},
and a Nodeview
class View {
constructor(node, view, getPos) {
const dom = document.createElement('div')
const label = document.createElement('label')
label.innerText = mytext(node, myConfig)
this.contentDOM = document.createElement('div')
dom.appendChild(label)
dom.appendChild(this.contentDOM)
this.dom = dom
}
}
Here mytext(node, myConfig)
will get some text by the node’s id
and lang
from myConfig
.
Everything works as expected at first.
Now myConfig
updates (from network). Accordingly, the document is also modified by some transactions. Some nodes are deleted, some added. Both cases work fine (everything updates accordingly).
But for some nodes, the id
and lang
does not change. The label in the nodeview does not update as the result of mytext(node, myConfig)
(since myConfig
is updated).
I find in NodeViewDesc.prototype.updateChildren
, it tries to reusing existing nodes, which might be the cause.
I really do not want to introduce an extra attribute for the node, so I am wondering if it is possible to toggle off this reusing mechanism.