Ineficient change detection
Zombobot1 opened this issue · comments
Zombobot1 commented
I need to detect as few changes as possible, however instead of one change I get a couple.
const changes = diff(['0', { a: 1 }], ['0', '1', { a: 1 }])
const expected = [ { type: 'CREATE', path: [ 1 ], value: '1' }]
const actual = [
{ path: [ 1 ], type: 'CHANGE', value: '1', oldValue: { a: 1 } },
{ type: 'CREATE', path: [ 2 ], value: { a: 1 } }
]
Is it expected behaviour? I have to use a double for loop to merge these changes back - that is not good for performance
Jacob Jackson commented
That is expected behavior. Unfortunately, I do not know of any way to do more advanced array diffing in a performant way. If you have any ideas, feel free to create a PR.