b310-digital / teammapper

Mindmapping made simple: Host and create your own mindmaps. Share your mindmap sessions with your team and collaborate on mindmaps.
https://teammapper.org
MIT License
238 stars 19 forks source link

Undo: Not working as expected after pasting #251

Closed JannikStreek closed 2 months ago

JannikStreek commented 8 months ago

Describe the bug When pasting some nodes, and the undo button is pressed, undo is essentially going always just one node back instead of going back the whole paste operation.

To Reproduce Steps to reproduce the behavior:

  1. Paste some nodes
  2. Click undo

Expected behavior All pasted nodes should be "undone"

sorenjohanson commented 3 months ago

Issue in detail is this:

When pasting nodes, the snapshot is updated sequentially, so instead of going from eg. 5 to 7 nodes (pasting 2 nodes), it goes from 5 to 6 to 7 nodes. In turn, the undo function literally just takes the latest snapshot and removes the last node from it.

Right now I think this'd require a rework of the way snapshots work, to keep both an old snapshot and a new one which we could undo, instead of updating it sequentially and just removing an index like we're doing it right now.

JannikStreek commented 2 months ago

then just leave this for now - I don't think its worth a big refactoring. I just stumbled upon this as this is not what I personally would expect as a user. We can refactor this when the need arises.