Undo Manager and Event Cascades

I have three nodes connected via two links (A —> B <—C ), I want to delete the center node (B) when one of the links is deleted (AB, CB), this works fine when I add a linkDisconnected action to node B. This works fine, even if I delete node A or C, node B gets deleted. My problem is when I wish to undo this deletion. So I delete node C, it of course deletes CB and thusly B and AB (so far so good), but when I hit ctrl Z, I only get back nodes B,C and CB Link, but I do not get AB link back).

As Node | GoJS API documents, you

must not modify what this Node is connected with.

That includes deleting any such Nodes.

It’s better to implement a “SelectionDeleted” DiagramEvent listener. For example, consider this initialization of a Diagram:

$(go.Diagram, . . .,
    { . . .,
      "SelectionDeleted": function(e) {
        e.subject.each(function(p) {  // e.subject is a collection of deleted Parts
          if (p instanceof go.Link) {

EDIT: upon re-reading your post, I notice that my code above does not handle the case where the user just deletes the A or C nodes and you want to also delete the B node. You’ll need to extend the “SelectionDeleted” listener appropriately.