I think i am facing a bug regarding setting value directly to a computed property that seem to break computing when it's related keys changes again, here an example:
o = Ember.Object.extend({
v1: null,
v2: function (){
console.log('evaluation of v2', arguments);
return this.get('v1') + '!!!';
}.property('v1'),
v1_Observer: function () {
console.warn('v1 changed:', this.get('v1'));
}.observes('v1'),
v2_Observer: function (){
console.info('v2 changed:', this.get('v2'));
}.observes('v2')
});
oi = o.create();
oi.set('v1', 'Value v1 one');
oi.set('v2', 'Value direct to v2');
oi.set('v1', 'Value v1 two');
Ember.assert('v2 should be "Value v1 two!!!"', oi.get('v2') === (oi.get('v1') + '!!!'));
I thinks there is 2 bugs here:
Everything works well until I update the computed property v2 directly with "set", when I update v1 again, v2 is not reevaluated.
when setting v2 directly its observer is called twice !
according to the documentation http://emberjs.com/guides/object-model/computed-properties/ we can directly set the value of a computed property with 'set' witch will be called with 2 parameters (key, value)! but in my tests, the property v2 only fires once, when v1 changed the first time.
this is the output of the console :
evaluation of v2 ["v2"]
v2 changed: Value v1 one!!!
v1 changed: Value v1 one
v2 changed: Value direct
v2 changed: Value direct
v1 changed: Value v1 two
Assertion failed: v2 should be "Value v1 two!!!"