Angular 10: Reverting to the Original Transaction

Hi, I have a question regarding the functionality of Transactions. On my GoJS diagram I am encapsulating my “filter” actions in a transaction to enable the user to control-z/y to undo and redo the filter action they are applying to the diagram. I want to include a reset feature that resets the diagram to the very first transaction.

Is there a way that I can accomplish this using the transaction functionality or do I need to approach this problem from another avenue?


EDIT1: My current idea is to use the UndoManager and a while loop like so:

while(canUndo) {

That sounds like a good way to do it:

var cmd = myDiagram.commandHandler;
while (cmd.canUndo()) cmd.undo();

Looks like that did the trick.