Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ember ember-views.render-double-modify

Tags:

ember.js

Using Ember.2.1.0-beta4

I am getting the "ember-views.render-double-modify" in a function triggered by the "didReceiveAttrs" of a subcomponent.

I tracked down the statement this.set('_columns', columns) that triggers the error. However, AFAIK this is the first time the attribute is modified.

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

How should I debug this -- is this an Ember bug, or are there other restrictions on setting attributes that aren't clear in the error? Note that the attribute is used in the component's template. Also the attribute is used in other computed attributes (e.g. [email protected] and _columns.[]).

like image 233
shaunc Avatar asked Sep 29 '15 18:09

shaunc


1 Answers

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

The error message is a little misleading, but the idea, I think, is that once you start to render you can't change properties until you are done. If necessary, use Ember.run.scheduleOnce('afterRender', ...).

like image 78
shaunc Avatar answered Sep 24 '22 11:09

shaunc