You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[3.1.0-beta.5] notifyPropertyChange() fails for plain objects #16427
test('notifies computed properties on plain objects',function(assert){letobj={a: 45,b: computed(function(){return~~(this.a/10);})};assert.equal(get(obj,'b'),4);obj.a=10;Ember.notifyPropertyChange(obj,'b');assert.equal(get(obj,'b'),1);// fails - returned value is still 4});
It works, as intended, if I do the same on an ember object.
A bit of further investigation reveals that this usage is scheduled for deprecation, that it also fails on canary, and that it works correctly if I use Ember.defineProperty(obj, 'b', …) to define the computed value.
Activity
mmun commentedon Mar 27, 2018
I assume you mean
computed('a', function(){ ... })?kanongil commentedon Mar 27, 2018
No, the code is as intended. Obviously, this is not what failed for me, but a reduced test case to expose the issue.
mmun commentedon Mar 27, 2018
This is working as intended then. Since
bhas no dependency ona, notifyingawill not causebto be invalidated.Did you mean
Ember.notifyPropertyChange(obj, 'b');?kanongil commentedon Mar 27, 2018
Ah, so I did make an error. Yes
Ember.notifyPropertyChange(obj, 'b');is the proper failing case.Sorry about that. I have updated the original post.
kanongil commentedon Mar 28, 2018
A bit of further investigation reveals that this usage is scheduled for deprecation, that it also fails on canary, and that it works correctly if I use
Ember.defineProperty(obj, 'b', …)to define the computed value.mmun commentedon Mar 28, 2018
Yeah, but we still need to make it work for backwards compatibility. The fix should be relatively easy but I haven't had time to work on it.
[BUGFIX release] Fix descriptorFor to support fallback
[BUGFIX release] Fix descriptorFor to support fallback
[BUGFIX release] Fix descriptorFor to support fallback
Add test for issue #16427
[BUGFIX release] Fix #16427
[BUGFIX release] Fix #16427
Add test for issue #16427
[BUGFIX release] Fix #16427
Upstream (#1)