Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ddenev opened this issue Jan 16, 2020 · 0 comments
Open

Comments

@ddenev
Copy link

ddenev commented Jan 16, 2020

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)?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant