Here is the situation :
If you are using Konvajs, a solution to build a undo-redo feature is to manage the stage state using JSON. But if you have a complex app, and many listeners. No simple solution.
The objective is to build a function that you can add to your code to include an action in the undo-redo logic.
In this example, all 3 Konva-elements belong to one group. The big circle and the big rectangle have a listener : if you click they change color and become draggable independently. The thin cyan rectangle is the group handler.
If its helps, go to my Github, try the project, it is not perfect but it is a start. Add a comment here if you have questions.Janfix github Konva undo redo !
The demo is here : https://www.wiquid.fr/projects/KonvaUndoRedo/