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
It seems there is bug in applyChangesToArray function when deleting multiple items.
In applyChangesToArray function to apply changes array it is being sorted on index field on ASC order then with reduce function it is applying changes to it.
The bug is happening when removing element from array revisedArray.splice(index, 1).
Let's say we have array with length of 5 and we want to delete 5 elements from array. On every iteration index is going up and the size of array is going down, by the time you are deleting element with index 3 revisedArray length is 2 then it cant remove any element. at the end it returns remaining 2 elements.
I have extracted applyChangesToArray function logic from code. You can try it in typescrip playground. Code is provided below
The text was updated successfully, but these errors were encountered:
It seems there is bug in
applyChangesToArray
function when deleting multiple items.In
applyChangesToArray
function to apply changesarray
it is being sorted on index field onASC
order then with reduce function it is applying changes to it.The bug is happening when removing element from array
revisedArray.splice(index, 1)
.Let's say we have array with length of 5 and we want to delete 5 elements from array. On every iteration index is going up and the size of array is going down, by the time you are deleting element with index 3
revisedArray
length is 2 then it cant remove any element. at the end it returns remaining 2 elements.I have extracted
applyChangesToArray
function logic from code. You can try it in typescrip playground. Code is provided belowThe text was updated successfully, but these errors were encountered: