Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4828

Computed property does not update when nested dependent property changes if computed setter is called

$
0
0

@Akash_D_Souza wrote:

Twiddle: https://ember-twiddle.com/706dc2003c71ffee87e85a87f467b1ef?numColumns=2&openFiles=controllers.application.js%2Ctemplates.application.hbs

I have a computed property (comp2) which depends on another computed property(comp1) which depends on a property, foo, in the controller. I also have another property valueOfComp2 in the controller which, for the sake of simplicity, is updated with the value of comp2 through update method

During init, I set comp2 to some value. After this, any update to foo will not reflect in comp2 or valueOfComp2

If I access comp1 or comp2 directly in the template, then there is no issue. If foo is declared as a dependency in comp2, then there is no issue. If I access comp1 at least once in update method, then everything works.

I sort of understand why this happens. But, why does it break only when there is a setter involved?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4828

Trending Articles