-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
changed each-behaviour for indexed arrays in 2.10 #14725
Comments
@Suven that seems like a bug. Perhaps the implementation has changed from using ⚡ cat changed-each.js a = [];
a[5] = 'foo';
a[6] = 'bar';
for (i = 0; i < a.length; i++) {
console.log(i, a[i]);
}
a.forEach(function(v, i) {
console.log(i, v);
}); ⚡ node changed-each.js
|
Yup, that might be. I guess for-loops were tempting with perfomance having in mind first. Just a little remark (although I guess that's obvious): This also happens when only the value is accessed (i.e |
I can confirm that it's bugged. Also using |
The issue here is that (for performance reasons) we are using a standard We did it intend to support sparse arrays in prior versions and making changes to 2.10+ to support them would negatively impact performance of all usages of We should document the fact that we do not support sparse arrays with For folks that definitely need this support, I'd recommend using |
@rwjblue is it alive? |
We need to write the docs I mentioned in my last comment. |
Hey!
I just noticed that Ember 2.10 introduces a changed behaviour when looping over indexed arrays with unset indexes.
Let's assume this array:
and this hbs:
In 2.9 this produces
5,6
and in 2.10 it produces0,1,2,3,4,5,6
.I also made a twiddle for that
The text was updated successfully, but these errors were encountered: