There is any good Idea turn off Undo/Redo temporary

When I add a new Node that deletable is false, it can deleted by undo manager easily.
https://jsfiddle.net/batobolg/napd18y6/5/
what I want, is that, I have some background process to complete when add a new Node, so I want wait until the process is done, then the node is become deletable. or undoable or redoable.
any idea that turn off Undo/Redo temporary?

Normally what is done is to avoid recording the change (in your case the addition of a node) by temporarily setting skipsUndoManager to true. This is done by the Diagram.commit and Model.commit methods when you pass null as the second argument to the commit method.

myDiagram.model.commit(m => {
    ...
    m.addNodeData(...);
    ...
}, null);  // skipsUndoManager

That prevents it from being undone or redone. However, that’s true forever, so even after you have changed the value of Node.deletable back to true, an undo will not remove the node. If that’s OK with you, then this is the action you should take.

If that’s not OK with you, I’m not sure there is a good answer. It’s an odd request to want to modify the transaction history. I suppose if the node addition were in a Transaction that you could entirely excise from the UndoManager.history, and if you re-inserted the transaction when it was OK to delete the node, you might meet that requirement. But while the transaction is not in the history, the user may get into confusing or contradictory states by performing undo and redo.

I just want to lock the Node between server side doing some initializing task. after initializing, want back to the normal Undo / Redo.

Does that special node need to be in the model?

Yes it need model, for save to the server.

Well, then you don’t really have any choice.
If it’s in the history, undo will remove the node and redo will re-add it.
If it’s not in the history, undo and redo won’t know about the node and will leave it alone.

I suggest that you initially add it while skipsUndoManager is true.

Then when you want to make it “real”, remove it with skipsUndoManager temporarily true, and then add it normally so that the addition is in the history.

OK, thank you. I will think about it.