Using AvoidsNodes for links with many nodes creates phantom links

When I use AvoidsNodes for links on a graph that contains many nodes/links, the graph renders with what appear to be phantom links (links not touching any nodes). However, if you then move nodes around, you can tell that the links really do belong to nodes and they will suddenly reconnect themselves.

I did read that there is a performance issue with AvoidsNodes so this might be related. Setting the link routing to Orthogonal seems to fix the issue and we are fine with this solution. But I thought you might want to know about this issue.

The attached examples actually do not contain a lot of links/nodes, but I thought it was easier to see the issue with these screen shots.

At first rendering:

Floating%20link%20at%20first%20rendering

After moving a node:

Floating%20link%20after%20moving%20node

Any calls to SuspendsUpdates in your code?

Setting the link routing to Orthogonal seems to fix the issue

But your sample has orthogonal links, so I don’t understand.

No calls to SuspendsUpdates.

That is the look we get with AvoidsNodes as well as Orthogonal. I assumed the only difference was that with AvoidsNodes, it would attempt to go around a node rather than having the link go behind a node?

Below is our template that works:

    var linkTemplate =
        GO(go.Link,
            { routing: go.Link.Orthogonal, corner: 5, layerName: "Background" },
            GO(go.Shape, { strokeWidth: 3, stroke: "black" },
                new go.Binding("strokeWidth"),
                new go.Binding("strokeDashArray"),
                new go.Binding("stroke", "isHighlighted", function (h) { return h ? defaultLinkColor : "black"; }).ofObject()),
            GO(go.Shape, { scale: 2, fromArrow: "" },
                new go.Binding("fromArrow"),
                new go.Binding("fill", "isHighlighted", function (h) { return h ? defaultLinkColor : "black"; }).ofObject()),
            GO(go.Shape, { scale: 2, toArrow: "" },
                new go.Binding("toArrow"),
                new go.Binding("fill", "isHighlighted", function (h) { return h ? defaultLinkColor : "black"; }).ofObject())
        );

Just realizing this is GoJS. I’ve moved it to that Category.

Thanks…thought that was the category I put it in but I must have missed it.

Thanks for the bug report. We can reproduce the problem. We’ll investigate it right away.

1 Like

We’ve released 2.0.19, which should have the bug fix in it. Could you please confirm that it works for you now?

This seems to fix the issue! Thanks for the quick response and fix.