Calling diagram.undoManager.redo() not work

Hi, dear Gojser, I have encountered this problem:
Redo triggered by Ctrl-Y works, but calling diagram.undoManager.redo() not work.

My code are as following:

diagramUndo = () => {
    if (this.canvas && this.canvas.undoManager.canUndo()) {

  diagramRedo = () => {
    if (this.canvas && this.canvas.undoManager.canRedo()) {
  diagramDeleteSelection = () => {
    if (this.canvas && this.canvas.canDeleteSelection) {

Have I missed something to call this API?

You are missing parentheses in your call to CommandHandler.canDeleteSelection.

Otherwise your code looks OK, assuming this.canvas returns a Diagram. When you step through the code, what happens?

Hi, Walter, thanks for pointing out the missing parentheses.
Here is what report in ‘canRedo()’:

And as you know the result is false.
But I have inspected the ‘undoManager’ and it has values of its ‘transactionToRedo’ and ‘transactionToUndo’.

I cannot explain that. Maybe the state changed between when you were stepping through it and you looked at the UndoManager. Or maybe the debugger caused the state to change. Not likely, but that’s all I can guess.