sproutcore/sproutcore — Issue #647: Chained observers on computed properties
Author: aflatter
Created: 2011-12-13 17:23:41+00:00
State: open

The following code does not yield the expected result:

var array, obj;

array = [];

obj = SC.Object.create({
array: array,
length: function() {
console.log('length');
return this.getPath('array.length');
}.property('*array.[]'),
lengthDidChange: function() {
console.log('lengthDidChange');
}.observes('length')
});

array.pushObject(1); // Does not trigger lengthDidChange.

Although it's a best practice to not depend on nested properties, this should either work correctly or trigger an error instead of failing silently.