anthonygore/vuex-undo-redo

Undo / Redo on a String changes it to an Object

Closed this issue · 2 comments

When I modify a state property that is a String, then redo, the state object is changed from a String to an Object. This causes things to display incorrectly.

Example:
default: Hello World
change: Hello World 42
undo: Hello World
redo: { "0": "H", "1": "e", "2": "l", "3": "l", "4": "o", "5": " ", "6": "W", "7": "o", "8": "r", "9": "l", "10": "d", "11": " ", "12": "4", "13": "2" }

Looks like this is due to using Object.assign on line 44. To fix this it may have to do some inspection of the object type. I may be able to come up with a fix.

Yeah you're right, your PR #7 should solve this.