Redraw links without changing position of nodes

If AvoidsNodes routing produces reasonable results when the user drags a node, but the overall performance of the layout is too slow with AvoidsNodes routing, then one possibility is to only turn on AvoidsNodes routing for those nodes that are being dragged.

If you find that possibility worth pursuing, you just need to override DraggingTool.doActivate. Something like:

    myDiagram.toolManager.draggingTool.doActivate = function() {
      go.DraggingTool.prototype.doActivate.call(this);
      var drags = this.draggedParts.toKeySet();
      drags.each(n => {
        if (n instanceof go.Node) {
          n.linksConnected.each(l => {
            if (!drags.contains(l)) {
              l.routing = go.Link.AvoidsNodes;
            }
          });
        }
      });
    };

No need for you to ever call invalidateRoute().

When the user changes the layout, what happens to the Layout that you return from the code that you quoted? Does it get assigned to Diagram.layout? If so, it would normally perform a layout, but you have set Layout.isInitial to false. Perhaps that is what is desired if the user loads some other model and you don’t want a layout to mess up whatever custom node positions you have saved in the model. But then you need to explicitly call Diagram.layoutDiagram(true) in order to force a re-layout.