Transactions : diagram vs model

Hi, we have four simple transactions in our application.

  1. updating node data
  2. deleting node
  3. changing links (from one parent to another )
  4. removing links

As per the documentation, all of the above code should be inside a transaction.
But should we use the transaction on diagram or model?
In one of your comments , i can see the below quote

“why don’t you remove the Links from the Diagram instead of removing the link data from the Model”

So, where do i find the information on ‘differences between diagram transactions and model transactions’ and ‘when to use what’?

below are the example code that we use,

Update Node

                let node = diagram.findNodeForKey(key);
                diagram.startTransaction(txnUpdateNode);

                node.data.name = data.name;
                node.data.title = data.title;
                node.data.description = data.description;
                node.data.type = data.type;
                node.data.status = data.status;

                node.updateTargetBindings();
                diagram.commitTransaction(txnUpdateNode);

Delete Node

            diagram.startTransaction(txnDeleteNode);
            diagram.commandHandler.deleteSelection();
            diagram.commitTransaction(txnDeleteNode);

The transaction methods on Diagram and Model are the same: they both call the corresponding methods on the model’s UndoManager.

We could have required you to call the methods on the UndoManager, but it’s just a convenience that you can call them on whichever object is handy, model or diagram.