vendredi 11 décembre 2015

Ember: How to force run loop to cycle before property change

I'm working with chart.js in ember and am encountering a bug where the graph breaks when I update the graph data without rerendering the component.

I am dynamically rendering this component with the {{component totalsChartComponent}} helper so if I could just set totalsChartComponent to undefined and let it cycle through the run loop before I update the components data it should clear out the component and allow it to render properly

I was trying to do this like this:

Ember.run.next(this, function () {
  this.set('totalsChartComponent', undefined);
})
Ember.run.next(this, function () {
  this.set('totalsChartComponent', "ember-chart");
}) 

but this does not appear to be running the second function a full run loop cycle after the first. Does this look like it should be working or am I doing something wrong here?




Aucun commentaire:

Enregistrer un commentaire