-
-
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
Ember.A(null)
now returns null
instead of []
#13284
Comments
Yep. This should totally be fixed and a tested added. Out of curiosity, which version of Ember.A(null) do you think makes more sense? @thoov can you do a quick audit of what else might have broken? |
@mmun I was just asking myself that. I read the API docs to see if they indicated one way or another, but it was still kind of ambiguous. I could probably make an argument either way. I sometimes use mapListValues(list) {
return Ember.A(list).map(item => { /* ... */ });
}) But I could be convinced that this isn't the purpose of |
…)` returning `null` instead of an array. See issue emberjs#13284.
This issue was fixed with #13287 being merged in. |
Thanks for catching this @workmanw! |
@rwjblue My pleasure! Random Fact: I just started using ember-try to test our app against "default", "stable", "beta" and "canary". Setting up a nightly cron to run the tests against all 4 scenarios and email me of any failures. On the first night, it caught this. If I can ever muster the cycles to write a blog post, it'll be about how to do this. |
…)` returning `null` instead of an array. See issue emberjs#13284.
Here is a pretty clear snippet that explains the issue:
So what happened? It looks like this commit broke it: 586d4c6#diff-7 :(. It seems very harmless, but that code is transpiled as:
The problem is that because
Ember.A(null)
has an argument length greater than 1, it's value [null
] is ultimately returned.Unfortunately this did break a few tests in our application. Specifically with the fixture adapter, see here: https://github.com/emberjs/ember-data-fixture-adapter/blob/master/addon/index.js#L298-L300 . I believe this to be part of the public API and should be fixed. If so, I'd be happy to add a test and take care of it.
EDIT: As a side note, I feel like I should voice some my concern about the aforementioned commit ( 586d4c6 ). There are several other places where
argValue || []
was replaced with default arguments, potentially leading to the same issue.The text was updated successfully, but these errors were encountered: