samedi 17 juin 2017

Ember parent child component, how to avoid unnecessary life cycle hook from triggering?

Child component property update is triggering all the parent component willUpdate,willRender,didUpdate and didRender life cycle hook methods. but I just updated property which is visible only the child component, It has nothing to do with parent component.

Twiddle to play.

Is there any way I can avoid this behavior?. [I tried with/without this._super(...arguments)]

PS: The reason is, I am doing some heavy operation in didRender hook of the parent component I don't want to run this unnecessarily. (One solution I can think of is manually checking for the specific property alone is changed or not by myself and run the heavy operation upon the condition).




Aucun commentaire:

Enregistrer un commentaire