Expand subgraph raises an exception

I’ve added a subgraph to my diagram.

Collapsing the graph works just fine. But then when I click on the expand button, nothing happens and there is the following exception in the console :

image

This is the template (taken from tutorial)

dia.groupTemplate =
      $(go.Group, 'Auto',
        { layout: $(go.TreeLayout) },
        $(go.Shape, 'Rectangle', { fill: 'orange', stroke: 'darkorange' }),
        $(go.Panel, 'Table',
          { margin: 0.5 },  // avoid overlapping border with table contents
          $(go.RowColumnDefinition, { row: 0, background: 'white' }),  // header is white
          $('SubGraphExpanderButton', { row: 0, column: 0, margin: 3 }),
          $(go.TextBlock,  // title is centered in header
            {
              row: 0, column: 1, font: 'bold 14px Sans-Serif', stroke: 'darkorange',
              textAlign: 'center', stretch: go.GraphObject.Horizontal
            },
            new go.Binding('text')),
          $(go.Placeholder,  // becomes zero-sized when Group.isSubGraphExpanded is false
            { row: 1, columnSpan: 2, padding: 10, alignment: go.Spot.TopLeft },
            new go.Binding('padding', 'isSubGraphExpanded',
              exp => exp ? 10 : 0).ofObject())
        )
      );

data :

  public diagramNodeData: Array<go.ObjectData> =

    [
      {
        key: 'Alpha', label: 'Alpha', color: 'lightblue', arr: [1, 2],
        expression: 'taskPropertySet.myProperty > 10', location: '-290 0', group: 'Group'
      },
      { key: 'Gamma', label: 'Gamma', color: 'lightgreen', location: '-119.5 0', group: 'Group' },
      { key: 'Group', isGroup: true, text: 'GROUP' },
      { key: 'PaletteDecisionNode', color: 'firebrick', figure: 'Diamond', label: 'Decision', location: '110 0' },
      { key: 'PaletteTaskNode', color: 'blueviolet', figure: 'RoundedRectangle', label: 'Task', location: '330 0' },
      { key: 'PaletteTaskNode2', color: 'blueviolet', figure: 'RoundedRectangle', label: 'Task', location: '110 150' }
    ];

  public diagramLinkData: Array<go.ObjectData> = [
    { key: -1, from: 'Alpha', to: 'Test', fromPort: 'r', toPort: '1' },
    {
      key: -2, from: 'Alpha', to: 'Gamma', fromPort: 'b', toPort: 't',
      points: [-169.5, 30.25, -159.5, 30.25, -144.5, 30.25, -144.5, 30.25, -129.5, 30.25, -119.5, 30.25]
    },
    { key: -3, from: 'Test', to: 'Test' },
    { key: -4, from: 'Gamma', to: 'Delta', fromPort: 'r', toPort: 'l' },
    { key: -5, from: 'Delta', to: 'Alpha', fromPort: 't', toPort: 'r' },
    {
      from: 'Gamma', to: 'PaletteDecisionNode', fromPort: 'R', toPort: '', key: -6,
      points: [1, 30.25, 11, 30.25, 11, 30.25, 11, 30.25, 100, 30.25, 110, 30.25]
    },
    {
      from: 'PaletteDecisionNode', to: 'PaletteTaskNode', fromPort: 'R', toPort: 'L', key: -7,
      points: [230.5, 30.25, 240.5, 30.25, 280.25, 30.25, 280.25, 30.25, 320, 30.25, 330, 30.25], text: 'NO'
    },
    {
      from: 'PaletteDecisionNode', to: 'PaletteTaskNode2', fromPort: 'B', toPort: 'T', key: -8,
      points: [170.25, 60.5, 170.25, 70.5, 170.25, 105.25, 170.25, 105.25, 170.25, 140, 170.25, 150], text: 'YES\n\n'
    }
  ];

It’s because you have a bunch of partly or fully disconnected Links.
That means, links that have Link.fromNode and/or Link.toNode being null.
Did you mean for those links to not connect between two nodes?

Thanks for reporting the problem – we’ll look into it.

Indeed from Gamma to PaletteDecisionNode the toPort is null. It’s strange because I got this link model from exporting diagram to json :

as you can see the link goes from Gamma to Decision node, so the toPort should not be null…

Nevertheless, I replaced the null value with a real port, and I still get the same exception.

If it can’t find a particular port, it will use the default port for the node.

But there’s no “Test” node. So a bunch of links are disconnected. And maybe others?

Thanks for reporting the problem. This will be fixed in 2.1.30, which we should be building soon…

You might want to try 2.1.30 to make sure it fixes the situation with partly disconnected links that you discovered.

Excellent, works just fine. Many thanks !