Nitesh singh
Nitesh singh

Reputation: 941

How to remove these deprecation on console on ember^2.0

while refreshing my site i am always getting some deprecation like this on console :

 A property of <Ember.OutletView:ember666> was modified inside the didUpdate hook. You should never change properties on components, services or models during didUpdate because it causes significant performance degradation. [deprecation id: ember-views.dispatching-modify-property]

How to remove these deprecation on console on ember^2.0 I am not using Ember CLI.

Upvotes: 2

Views: 691

Answers (2)

bluscreen
bluscreen

Reputation: 41

Romans solution worked well for me, except for some syntax problems. I needed to set a default value to a child component. Heres the code:

initDefValue: function() {
    const valEmpty = Ember.isEmpty(this.get("value"));
    if (valEmpty) {
        Ember.run.scheduleOnce('afterRender', this, () => {
            this.sendAction("initValue", this);
        });
    }
}.on("didReceiveAttrs"),

Upvotes: 0

Roman
Roman

Reputation: 13058

Usually it means, that you need to do the work inside the didReceiveAttrs method, rather than the didUpdate. However, it you must have it in didUpdate, you can do something like this:

didUpdate() {
  Ember.run.scheduleOnce('afterRender', this, => {
    // some code
  });
}

However it most likely will do some rendering twice (however it already does it twice - hence the deprecation).

Upvotes: 2

Related Questions