Skip to content

Undo/redo based on reverse actions - seems possible with this library? #24

Open
@ddenev

Description

@ddenev

Hi,

I found this library when searching for undo/redo implementations for my Vue/Quasar application. I must say that it looks very well written and documented.

One thing that I am not very fond of in this approach though is the resulting complexity of the algorithm (O(n)) which depends on the number of actions in the undo stack. I would rather prefer to implement the undo/redo in my app via executing reverse actions, e.g. to undo 'addItem' I would execute 'removeItem' and vise versa.

I noticed that the library implements undo/redo callbacks to be used for mutations with side effects, so I was thinking if these could be used to achieve what I want. I would also combine this with actionGroups in order to always undo/redo actions instead of mutations.

So my question is - can I use the undoCallback, redoCallback, actionGroups features only in order to:

  • always undo/redo actions instead of mutations and
  • execute undos via dispatching the reverse actions instead of replaying the undo stack (identical for redos)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions