Undo without delete

Hi! I use ymap to store the state of an object. In my application, I want to provide the ability to restore deleted objects, so I’m thinking of adding an isDeleted field to the state, which will be stored like all other fields in ymap. Everything seems to be fine, except for undo/redo. Previously, when creating a new yMap, undo deleted it, but now I don’t like this behavior. I need that after creating a new yMap, undo only updates the field in it to isDeleted=true. To solve this, the only thing that comes to my mind is to split the creation into 2 stages. First create yMap (without saving in UndoManager), and then update isDeleted=false. But these will be 2 different transactions, maybe there is a better way?

I’d assume that you only need to set the property isDeleted=true on the existing Y.Map? Why would you need to create it and then set isDeleted=true?

In any case, I think creating two transactions is the way to go, unless you want to modify Y.UndoManager.