Component lifecycle & didReceiveAttrs



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 =;). 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).


It’s reasonable but slightly messy :wink: Rhere’s an example of polling here as part of the ember concurrency setup that might give you some ideas …