I would like to catch an undo event and do some changes according to it. Is there a event I should be listening to for the same.
What kind of changes? You can check for transactions with an
"undo" user event, but you can’t modify undo transactions, since that would break the history state.