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

Component lifecycle & didReceiveAttrs

$
0
0

@accelerate wrote:

Hello,

Hopefully quick question. Will a component go through its lifecycle only if its attributes change? ie, if I have

{{my-component foo=bar}}

And bar never changes (or it gets set to the same value as before), that means the component lifecycle will never run again, correct?

The reason I ask is that I necessarily need to have some components refresh itself (by running some loading methods within the component) even if its attributes remain the same. So what I decided to do was pass in a timestamp (so in the above, I set bar = Date.now();). And I'm relying on didReceiveAttrs() to execute every time I update that timestamp so I can go through my refreshing logic. I'm wondering if this is actually an okay thing to do (paradigm-wise).

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4828

Trending Articles