Ember ember-views.render-double-modify

Using Ember.2.1.0-beta4

I get "ember-views.render-double-modify" in a function called by the "didReceiveAttrs" subcomponent.

I tracked down the statement this.set('_columns', columns) , which causes an error. However, AFAIK is the first time an attribute has been changed.

To debug it, I created an observer for the modified attribute and set a breakpoint there. However, the observer is called only once, and the error still exists, so it seems like this is the first call.

How do I debug this - is it an Ember error or are there other restrictions on setting attributes that are not clear in the error? Note that this attribute is used in the component template. The attribute is also used in other computed attributes (for example, _columns.@each.width and _columns.[] ).

+5
source share
1 answer

For posterity, the answer in my case was: _columns used in the template. Thus, for didReceiveAttrs subcomponent to be invoked, the previous value of _columns already used.

The error message is a little misleading, but the idea, I think, is that after you start rendering, you will not be able to change the properties until you finish. Use Ember.run.scheduleOnce('afterRender', ...) if necessary.

+6
source

Source: https://habr.com/ru/post/1232567/


All Articles