Cancel deletion?

In my current use case I’m working with Y.Snapshot, my user is working on a snapshot, doing some updates validating and send the snapshot update to others (like a suggestion).
I’m also computing deltas and rendering them has an overlay on the editor.

My current challenge is related to deletion, my user want to revert a deletion like it never happen.

So I’m using Y.UndoManager that looks perfect for that use case. It do record the user actions (like the deletion) but then when we call Undo it is basically inserting what has been deleted and this resulting to a delta remove & insert the same text.
I’m wondering is there a way to simply cancel a deletion? I mean deletion are stored to a deleteSet next to store, could we remove that deletion?

EDIT 1:
After some deeper look, it looks like my Y.Array elements are duplicated and the duplicate has redone attribute that is strictly equal to ID of the left node (original node).
So the right node with redone is the deletion “canceled” by UndoManager, so I just made the assumption to skip that node when computing my deltas.
Now the issue is the left node has for ID the current client with a clock that is unknown from the previous snapshot making it “as new”.

@dmonad Do you think you could give me some hint there?

  • How do work UndoManager?
  • What is the use of redone attribute on the items?

Your help would be very appreciated :slight_smile: