vuex-undo-redo
vuex-undo-redo copied to clipboard
Fix redo/undo bug. Now checks if object is Array before Object.assign
Ran into this bug while using the plugin. If a Vuex mutator is called with an Array (e.g. ["a", "b", "c"]
) on undo/redo it will pass in an object with keys of the index (e.g. {0: "a", 1: "b", 2: "c"}
). This PR fixes that by checking if the object is an Array and if so, it effectively calls Object.assign([], obj)
instead of Object.assign({}, obj)
.
Let me know if there are any stylistic compatibility issues I should fix.