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
Describe the bug
Index of Y.Array in forEach start from 1
It seems that the issue only affect 14.0.0-0
To Reproduce
test('yarray-index-test', () => {
const doc = new Y.Doc();
const yArr = doc.getArray('');
yArr.push(['elem 1', 'elem 2']);
yArr.forEach((elem, index, arr) => {
console.log(`index: ${index}`); // starts from 1
arr.get(index); // error will be thrown when get the last element with index.
});
});
Describe the bug
Index of Y.Array in forEach start from 1
It seems that the issue only affect 14.0.0-0
To Reproduce
It seems that the index got increased by this line: https://github.com/yjs/yjs/blob/v14.0.0-0/src/utils/ListCursor.js#L313
Expected behavior
index in the forEach should starts from 0,
Environment Information
The text was updated successfully, but these errors were encountered: