vuex-undo-redo
vuex-undo-redo copied to clipboard
Tagging specific commits to roll back several commits at a time
Hello,
Just wanted to share here an update to the plugin that I worked on. I opened a pull request for it as I don't consider it an "issue" :) But I would understand if you don't want to merge it in, as it breaks the current API.
It adds a way to add tags to mutation so that one can roll back to any "saved tag" (basically, undoing a bunch of commits in one undo(tagName) call.
Also, I needed to refactor the internal data used for storing the done / undone arrays as it was incompatible with Vuetify which uses done for some of their components ==> this should not break the plugin public API.
I tagged it v2 because it breaks the original API by forcing the $store to be passed as an option: I needed it in order for the TAG_UNDO_MUTATION mutation to be added (didn't find any other easy & cleaner way).
Also, I added a way to pass the emptyState as an option since the tags are stored in the state (in their own module) and this option seemed like the best way to merge empty state objects (if ignored, developers need to add the undoRedo: { lastUndoRedoTag: null } bit to their emptyState mutation, as described in the README.
@anthonygore, happy to discuss any changes / updates if you deem this PR useful.
excellent work!