You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to use the diff and patch functions for an undo function in my React-Redux project. It works fine, when I am deleting the last item, but not when I deleting the first one or an item inside.
smart array diffing using LCS, IMPORTANT NOTE: to match objects inside an array you must provide an objectHash function (this is how objects are matched, otherwise a dumb match by position is used). For more details, check Array diff documentation
You should provide a hash function, otherwise it based on the position, thus deleting the "first element" only changes the position of the remaining elements. Which will show that the last element is deleted.
Hey
I want to use the diff and patch functions for an undo function in my React-Redux project. It works fine, when I am deleting the last item, but not when I deleting the first one or an item inside.
For example I delete the first item:
`{"state":[
{"x": 1, "y": 3},
{"x": 4, "y": 5},
{"x": 2, "y": 6},
{"x": 0, "y": 9}
]
}
{"state":[
{"x": 4, "y": 5},
{"x": 2, "y": 6},
{"x": 0, "y": 9}
]
}`
The result of diff is:
The text was updated successfully, but these errors were encountered: