ember-script icon indicating copy to clipboard operation
ember-script copied to clipboard

dependency inference - missing some dependent properties

Open huafu opened this issue 10 years ago • 2 comments

Cannot explain better than an example:

class Person
  postsDisplay: ~>
    @user.method @name

will give you:

Person = Ember.Object.extend({
  postsDisplay: Ember.computed(function () {
    return get$(this, 'user').method(get$(this, 'name'));
  }).property('user')
});

As you can see the name is not added in the dependencies of the computed property. Sounds like this happens when having the properties in parameters. Also:

class Person
  postsDisplay: ~>
    @method @name

would give:

Person = Ember.Object.extend({
  postsDisplay: Ember.computed(function () {
    return this.method(get$(this, 'name'));
  }).property('')
});

huafu avatar Jul 12 '14 08:07 huafu

Please make a fix for this :+1: Hmm... On closer thought, I think the ember-script compilation is correct behaviour??

kristianmandrup avatar Aug 30 '14 10:08 kristianmandrup

Sorry to answer only now, I missed your message.

No, it should depend on this.user and this.name since they are both used. Also the second example, the method is most likely to return some different value in case this.name is changed. And the method might be a computed property too so it should be part of the dependent keys.

huafu avatar Jan 28 '15 00:01 huafu