Previously, Ember.get(obj, '') would return obj.
This behavior was removed in #14345 and caused some breakage in ember-cp-validations which relied on this. https://github.com/offirgolan/ember-cp-validations/pull/380
My opinion is this was likely a bug that people relied on that could instead be marked for deprecation.
@jasonmit see https://github.com/emberjs/ember.js/issues/14386 for discussion of a similar issue related to the change from #14345
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.
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:
found the cause but not the reason: in the test, we were rendering a component like so:
this.render(hbs`{{milestones/assessment-plot
plotStyle="overview"
assessmentsForThisGraph=[]
rubric=academicRubric
showStandards=false
}}
`);
This produced a render call to HTMLBars like such:
this.render(Ember.HTMLBars.template({
'id': 'Q8LZjo7P',
'block': '{"statements":[["append",["helper",["milestones/assessment-plot"],null,[["plotStyle","assessmentsForThisGraph","rubric","showStandards"],["overview",["get",[""]],["get",["academicRubric"]],false]]],false],["text","\\n "]],"locals":[],"named":[],"yields":[],"blocks":[],"hasPartials":false}',
'meta': {}
}));
(0, _chai.expect)(this.$('[data-test-nodata-add-assessment]')).to.not.exist;
Notice the ["overview",["get",[""]]… in the above. That get instruction seems to be getting called with an empty string. On a hunch, I replaced assessmentsForThisGraph=[] in the render call with assessmentsForThisGraph=(array). This fixed the tests, but it seems like I shouldn't have to use a helper from a third-party library to get the tests to run?
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.
Most helpful comment
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.