Link with adjusting=End doesn't recompute route correctly on group collapse when sibling links exist

When collapsing/expanding a group that contains nodes connected by multiple links, a link with adjusting: End does not get its computePoints() called correctly if there are sibling
links (with adjusting: None) between the same nodes. The link with adjusting: End ends up with incorrect/stale point coordinates.

Key observations:
• If the link with adjusting: End is the only link between the nodes, collapse/expand works correctly
• The bug only occurs when there are multiple links and at least one has adjusting: End while another has adjusting: None
• On collapse, computePoints() is called for the adjusting: None link but appears to be skipped or called at the wrong time for the adjusting: End link
• The adjusting: End link retains its old absolute point coordinates instead of properly adjusting to the new node positions

Minimal reproduction:

html

 <!DOCTYPE html>
     <html>
     <head>
       <title>Link Adjusting Bug - Group Collapse</title>
       <script src="https://unpkg.com/[email protected]/release/go.js"></script>
     </head>
     <body>
     <div id="myDiagramDiv" style="width:800px;height:400px;border:1px solid #ccc"></div>
     <button onclick="addLink()">Add Link</button>

     <script>
     const $ = go.GraphObject.make;

     class DebugLink extends go.Link {
       computePoints() {
         console.log(`computePoints on "${this.data?.key}" (adjusting=${this.adjusting === go.LinkAdjusting.End ? 'End' : 'None'})`);
         return super.computePoints();
       }
     }

     const diagram = $(go.Diagram, 'myDiagramDiv', {
       'undoManager.isEnabled': true,
       'animationManager.isEnabled': false,
       'LinkReshaped': e => e.subject.adjusting = go.LinkAdjusting.End
     });

     diagram.nodeTemplate = $(go.Node, 'Auto',
       { locationSpot: go.Spot.Center },
       new go.Binding('location', 'loc', go.Point.parse).makeTwoWay(go.Point.stringify),
       $(go.Shape, 'Rectangle', {
         fill: 'lightblue', width: 80, height: 40,
         portId: '', fromSpot: go.Spot.AllSides, toSpot: go.Spot.AllSides
       }),
       $(go.TextBlock, { margin: 8 }, new go.Binding('text', 'key'))
     );

     diagram.groupTemplate = $(go.Group, 'Vertical',
       { layout: $(go.GridLayout, { wrappingColumn: 1 }) },
       new go.Binding('location', 'loc', go.Point.parse).makeTwoWay(go.Point.stringify),
       new go.Binding('isSubGraphExpanded').makeTwoWay(),
       $(go.Panel, 'Horizontal', { background: 'lightgray' },
         $('SubGraphExpanderButton'),
         $(go.TextBlock, { margin: 5, font: 'bold 12px sans-serif' }, new go.Binding('text', 'key'))
       ),
       $(go.Placeholder, { padding: 10, background: 'whitesmoke' })
     );

     diagram.linkTemplate = $(DebugLink,
       { reshapable: true, resegmentable: true, routing: go.Routing.Orthogonal },
       new go.Binding('adjusting').makeTwoWay(),
       new go.Binding('points').makeTwoWay(),
       $(go.Shape, { strokeWidth: 2 }),
       $(go.Shape, { toArrow: 'Standard' })
     );

     diagram.model = new go.GraphLinksModel([
       { key: 'Group A', isGroup: true, loc: '0 0', isSubGraphExpanded: true },
       { key: 'Group B', isGroup: true, loc: '300 0', isSubGraphExpanded: true },
       { key: 'Node A', group: 'Group A', loc: '50 50' },
       { key: 'Node B', group: 'Group B', loc: '350 50' }
     ], []);

     let linkCount = 0;
     function addLink() {
       diagram.model.commit(m => {
         m.addLinkData({ key: 'Link ' + (++linkCount), from: 'Node A', to: 'Node B' });
       });
     }
     </script>
     </body>
     </html>

Steps to reproduce:

  1. Click “Add Link” to create Link 1 (adjusting=None)
  2. Click “Add Link” to create Link 2 (adjusting=None)
  3. Reshape Link 2 by dragging its handles (this sets adjusting=End)
  4. Collapse Group B using the expander button
  5. Observe: Link 2 (adjusting=End) has incorrect route, Link 1 (adjusting=None) is correct

Expected: Both links should correctly adjust their routes when group collapses.

Actual: The link with adjusting: End maintains stale/incorrect point coordinates.

Which version of GoJS are you using?

3.1.7, but upgrading to latest does not seems to resolve the issue.

Here’s what I have running your (unaltered) code, after reshaping one of the two Links:

Then I collapse Group B:

That looks correct to me. The reshaped link continues to have its middle (vertical) segment close to Node A.

Further expands/collapses, undo/redo, and some other editing all seem to work as I would expect.

What am I doing wrong in order to reproduce the problem?

  1. Press “Add link” 2 times.
  2. Reshape link by dragging by handles in the middle.
  3. Collapse Group A.
    This is the result:

Found what is the reason for you not being able to reproduce. Please try to reshape top link, not bottom one. Last one added is the problem.

Got it. Thanks – we’ll investigate.