makeTwoWay and undo

I have a code to do two way binding

        node.bind(new Binding("height", "", (data: AllFlowNodeType, node: Node) => {
            let bounds = data.BPMNShape.Bounds;
            return bounds.height 
        }).makeTwoWay((height, data) => {
            let task = data as ServiceTask;
            task.BPMNShape.Bounds.height = height;

now this work perfect.

but when I do undo operation I noticed that the makeTwoWay function is not called (the console log is empy).
so my model is not in sync with the diagram.

on the screen everything looks OK,

why makeTwoWay is not called?

Bindings are not supposed to be evaluated during undo or redo.

Is your data of type AllFlowNodeType or ServiceTask?

AllFlowNodeType and ServiceTask is are practically the same, both of the holds BPMNShape.Bounds.height.

so if binding is not supposed to be evaluated during undo or redo how does my model be updated?

in my case it is not updated.

If you called Model.set on data.BPMNShape.Bounds, "height", ..., then the undo and redo will re-set the property, in addition to re-setting of the GraphObject.height property.

the height is kept in my model like this BPMNShape.Bounds.height
I did try to use setDataProperty like this

.makeTwoWay((height, data:AllFlowNodeType, model:GraphLinksModel) => {
            data.BPMNShape.Bounds.height = height;
            model.setDataProperty(data,"BPMNShape", data.BPMNShape);

it does not work.
what am I doing wrong?

model.setDataProperty(data,"BPMNShape", data.BPMNShape) looks like it will always be a no-op, since it is equivalent to data.BPMNShape = data.BPMNShape.

Why can’t you do what I suggested?
model.set(data.BPMNShape, "height", height)
instead of both of those lines of code?

it works!!