Computed property observers not firing for @each.property.[]

Cross posted from https://github.com/emberjs/ember.js/issues/5043

Am I missing something fundamental here or should this work?

var Foo = Ember.Object.extend({
  friends: function() {
    console.log('friends');
    return this.get('groups').reduce(function(acc, group) {
      return acc.concat(group.get('accounts.content'));
    }, []);
  }.property('groups.@each.accounts.[]'),
  foo: function() {
    console.log('foo');
  }.observes('groups.@each.accounts.[]')
});
 
 
window.foo = Foo.create({
  groups: Ember.A([
    Ember.Object.create({
      accounts: Ember.A(['foo', 'bar', 'baz'])
    })
  ])
});
 
foo.get('friends');
foo.get('groups')[0].get('accounts').pushObject('asdf');

I believe Ember doesn’t support nested @each observers. You should rewrite your code using addArrayObserver. It’s one of the possible solutions.

1 Like

Ember definitely does not nested @each observers.