Too many transaction changes for ExternalCopy transaction

We listen to diagram model changes through “diagram.addModelChangedListener” and capture finished transactions (event.isTransactionFinished). Those diagram transactions are further sent to our server over the network for processing.

On dragging and dropping a node from the diagram palette on the diagram, we randomly receive a large number of transaction changes under “ExternalCopy” transaction. Even though the only action performed is adding a node to the diagram from the palette, all the nodes are in the included transaction changes, and that too 3 or 4 times for each node. This does not happen every time - happens rarely. In usual cases, we receive only a few transaction changes which are expected.

This unusual case results in an inefficient and very large payload for the request which we sent to the server. We are looking for a way to ignore those unnecessary transaction changes but could not find what causes the model to raise so many transaction changes.

Can you please help us identify action which might be causing the diagram to raise so many transaction changes? Also it would be helpful if can share more information about the “ExternalCopy” transaction, we could not find much information about it on the GoJS documentation.

Thanks

The “ExternalCopy” transaction name is only used by the DraggingTool when an external drag-and-drop is successful. An “ExternalObjectsDropped” DiagramEvent happens then.

I just tried a simple app holding a Palette and a Diagram, and I added this ModelChanged listener:

    $(go.Diagram, . . .,
      {
        "undoManager.isEnabled": true,
        "ModelChanged": e => {
          if (e.isTransactionFinished) {
            console.log(e.propertyName, new Date().toLocaleString(), e.object);
          }
        }
      })

Even after dragging something from the Palette in and out of the palette, in and out of the target diagram, and all over the page, after dropping in the Diagram there was only a single transaction. That Transaction, named “ExternalCopy”, only had 9 ChangedEvents in its Transaction.changes list.

Holding down the control key, to force a copy (even though only a copy is permitted), produced the same results. Holding down the shift key, to try to force a move, produced the same results.

Hitting the Escape key, aborting the transaction, resulted in no console message, as expected.

Dropping outside of the target Diagram did not result in any console message.

So I think the basic mechanism is correct and robust. Maybe you have some additional listeners or event handlers defined that are resulting in additional transactions?