sproutcore/sproutcore — Issue #645: SC.Enumerable.lastObject is never invalidated.
Author: aflatter
Created: 2011-12-13 16:51:40+00:00
State: open

Running the code below should print the following line to the console:

contentDidChange 1
1

Instead, `contentDidChange` is never triggered and `App.obj.content` stays null.

Sample code:

var App = window.App = {};

SC.run(function() {
App.array = SC.ArrayController.create({
content: []
});

App.obj = SC.ObjectController.create({
contentBinding: 'App.array.lastObject',
contentDidChange: function() {
console.log('contentDidChange', this.get('content'));
}.observes('content')
});
});

SC.run(function() {
App.array.pushObject(1); // Does not trigger contentDidChange.
});
console.log(App.obj.get('content'));