-
-
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: Ember.get with empty string as path no longer returns target object #14572
Comments
Thanks, I'll close this one |
I still think we can make an assertion that the key passed to Ember.get is not empty string. That would at least have made the other logic issue (in Ember-count-validations) easier to track down. |
obj` This adds an assertion to let the user know when they are using an empty string with an object that has no `''` property. I'm keeping `Ember.get({'': 42}, '')` as a valid expression given it is a tested behaviour. Addresses [this comment](emberjs#14572 (comment)) in emberjs#14572
This adds an assertion to let the user know when they are using an empty string as the key in `Ember.get`. Addresses [this comment](emberjs#14572 (comment)) in emberjs#14572
This adds an assertion to let the user know when they are using an empty string as the key in `Ember.get`. Addresses [this comment](emberjs#14572 (comment)) in emberjs#14572
This adds an assertion to let the user know when they are using an empty string as the key in `Ember.get`. Addresses [this comment](#14572 (comment)) in #14572 (cherry picked from commit d03ff1f)
Note that this is a breaking change, and should have been a deprecation (in my opinion), not cause working tests to fail when migrating from 2.7 to 2.10 and requiring patch to add ons relying on the prior behavior. In my case an add-on ember-cli-select-picker. |
This is breaking a bunch of our tests – is there any particular trick to finding the call site where Ember.get is being called with an empty string? This error is occurring when an acceptance test tries to render a handlebars template and my stack-trace has no helpful information. Not sure how else I can debug this. update:
This produced a render call to HTMLBars like such:
Notice the I'm going with this fix for now but would love to know more if anyone has ideas. also, I don't see this anywhere in deprecation notes, but it really ought to be mentioned somewhere, if it isn't. |
Previously,
Ember.get(obj, '')
would returnobj
.This behavior was removed in #14345 and caused some breakage in ember-cp-validations which relied on this. adopted-ember-addons/ember-cp-validations#380
My opinion is this was likely a bug that people relied on that could instead be marked for deprecation.
The text was updated successfully, but these errors were encountered: