Please, I would like to know if I might be doing something wrong. I’m calling the “diagram.undoManager.clear()” method, but I’m still able do undo some operations after that. Is there any possible reason for this happening?
I need to clear this history because some operations are persisted on my database (like creating a new node, or changing its parent). And my intention is to clear all history after these operations.
Printing the “historyIndex” property on console, even shows the -1 value, meaning that my stack should be empty. However, pressing CTRL Z still have the undo effect.
Well, I don’t have any transactions opened at this point, however I realized that this behavior might be a side effect of updating my nodeDataArray. After each operation like changing a parent or creating a new node, my application reloads the nodeDataArray from the backend, which will contain a new node or a different parentKey pointer if compared with the previous state.
It happens that I was calling the undoManager.clear after updating my nodeDataArray, like the following: