"Undo" button in Edit mode
Opened this issue · 0 comments
tchapeaux commented
When editing a barillet, it's easy to do some mistakes ("oops I deleted a theme card
We should have a modification history and be able to undo/redo the changes. Maybe map it to CTR/CMD+Z as well?
We already have kind of the basis for it because we have a reducer function:
So we would need to:
- Store each
action
send to the reducer in a stack - Add a
prevState
attribute to the payload for destructive actions (e.g. for update: it would contain the previous value) - Write a "reverseReducer" that does the undo action
- When clicking on "Undo", pop the last action from the stack and run it through reverseReducer
- Maybe "Undo" should be an action as well? 🤔 This might need some thoughts