Skip to content

supply correct start parameter to insertElements#6008

Merged
simonbrunel merged 2 commits intochartjs:masterfrom
kurkle:fix-start-index-in-onDataPush
Jan 25, 2019
Merged

supply correct start parameter to insertElements#6008
simonbrunel merged 2 commits intochartjs:masterfrom
kurkle:fix-start-index-in-onDataPush

Conversation

@kurkle
Copy link
Member

@kurkle kurkle commented Jan 23, 2019

in onDataPush, data is already in the data array.

So say the data was [1,2,3] before push and [4,5,6] was pushed.
Because data is already in place here, data.length would be 6 so start parameter would have been 5 to insertElement.

splice is executed on meta.data there, with given the index relative to start.
In
MDN its said about start: "If greater than the length of the array, actual starting index will be set to the length of the array."
So the wrong start is fixed by splice.

However, when used for something else (I did), then things would go wrong. So this might as well be fixed for possible future changes.

@simonbrunel simonbrunel added this to the Version 2.8 milestone Jan 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants