Misbehaviour in GraphLinksModel untill i use updateTargetBindings

hi walter,

please find the code,

this.diagram.model = new go.GraphLinksModel();
this.diagram.model.linkFromPortIdProperty = “fromPort”;
this.diagram.model.linkToPortIdProperty = “toPort”;
this.diagram.model.nodeDataArray = Array.from(nodesMap.values());
this.diagram.model.linkDataArray = linksFinalArray;

and this is my event code

diagram.addDiagramListener(“BackgroundSingleClicked”,(e)=>{
diagram.updateAllTargetBindings();
});

before raising the event diagram looks like

after raising the event diagram changes as expected

can i expect above diagram without raising the event.

thak you walter.

Odd. Diagram.updateAllTargetBindings only updates data Bindings. It has no effect on relationships between Nodes and Links or between Parts and Groups. So I’m guessing that you have one or more Bindings that are being evaluated too early for them to produce the value that you want. That might be, for example, because you have a Binding that has a dependence on another Part than the one the Binding is defined on. For example, if you have a Binding on a Link that depends on either the Link.fromNode or the Link.toNode, those bindings might not be able to find any connected node at the time the link is added to the diagram, because the link’s connections haven’t been set yet.