-
-
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
[Bug] Object.keys() was called on the positional arguments array for a helper, which is not supported #19350
Comments
The error does seem appropriate to me. Why would you use |
@rwjblue - well, native JS allows that. The error is an Ember one. Also, you personally requested an issue to be opened on this. 😄 |
Haha, indeed I did! We could possible figure out how to avoid the error, but it does seem pretty bizarre to use |
@rwjblue - you're definitely right that it is a strange use. For an example as to when one might do that check this comment. Also, note that it's just strange/unnecessary to have this assertion. Why does Ember have it? What's the problem with doing that? It's just plain JS. That's my point. Not specifically that it is particularly useful to call |
@boris-petrov since we are using a native Proxy, it is not just plain JS. We actually do need to write code here, one way or the other. When I made the call on this, my thinking was: This is a tradeoff between supporting a bad pattern that is inefficient, and shipping more code to the client to support said pattern, or asserting and telling the user to do a better pattern and shipping less code to the client. Also if we did support I don't have a super strongly held opinion here. I admit it's probably a little surprising the first time you run into it, but it also prevents you from iterating an array in a very slow way, compared to the alternative. |
@pzuraq - I fully agree with what you wrote. I would do this - if the added code is up to 10 lines of code, I would add it - that's not too much to support (and people won't be surprised when they try doing something similar to what I wrote above; and you would support something that is just JS - native proxies are also just JS 😄). If it's more, then leave it as is. In any case I'll close the issue. Thanks for the discussion! |
🐞 Describe the Bug
Calling
Object.keys
(orObject.values
which internally uses it) on the positional arguments array of a helper does not work.🔬 Minimal Reproduction
😕 Actual Behavior
🤔 Expected Behavior
This to work.
🌍 Environment
➕ Additional Context
Found when implementing this and mentioned here.
The text was updated successfully, but these errors were encountered: