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

孤者浪人 提交于 2019-12-12 05:59:54

问题


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 check.
Twiddle to check with powerselect - when mouse over dropdown option it's triggering the all of its parent component willUpdate,willRender,didUpdate and didRender life cycle hook methods.

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

来源:https://stackoverflow.com/questions/44606056/ember-parent-child-component-how-to-avoid-unnecessary-life-cycle-hook-from-trig

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!