There’s a twoway binding on node.location by a customized function, like
new go.Binding("location", "", data => new go.Point(
data.meta.locationX || 0,
data.meta.locationY || 0
)).makeTwoWay(
(point, data) => {
data.meta.locationX = point.x;
data.meta.locationY = point.y;
}
),
.
Moving nodes are synchronized correctly except undoing. When using debug version, there’re no warning messages about transactions. The history in undoManager recorded the moving. More importantly, the position of the part is changed.
If diagram.updateAllTargetBindings() is called, all undone parts will get its moved positions instead of the original one, where the latter is expected for undo.
model.set(...) is the key to solve the problem. Maybe the data binding could do some magic like vue’s reactive system via Object.defineProperty(...) so data binding will be automatically recorded. :)
As we recently found out the hard way, doing what Vue does automatically can have very bad unintended consequences. And programmers can implement updating property setters themselves. That is why GoJS model data are just plain JavaScript Objects.