How can I skip the default transaction in undoManager?

When I set my transactions, there are always default transactions like “layout” in undoManager history. How can I skip these default transactions?

You can use skipsUndoManager, most likely.

var oldValue = myDiagram.skipsUndoManager; // just to be safe
myDiagram.skipsUndoManager = true;
... some code
myDiagram.skipsUndoManager = false;

If you search the code on Github, you can see in the samples that we use this from time to time: Search · skipsUndoManager · GitHub

After some of my undo operations. Something goes wrong in link connection. The link seems connects to the wrong place. Any method to update or refresh the link connection?

I strongly recommend not using Diagram.skipsUndoManager. Try things without and make sure that undo and redo work correctly.

Missing some ChangedEvents in the UndoManager’s Transaction may cause unusual behaviors during undo.

Then you can describe what you would like to have happen differently.