I have a little problem with promises. I am sure that the looping cycle solves my problem, but it is still a bit unclear. The problem is here: I have a component that makes some heavy ajax calls that may take a few seconds. When the solution promises, I set the data to componentnent so that it can display a graph. The problem is that if the user navigates to a new page, the view (and all components) is destroyed, and when resolving promises, it tries to install an object that does not yet exist. And boom, I have an "attempt to set an object to a destroyed error." Here is a small part of the method that is called when a solution is promised:
updateChart: function(timeframe, interval) {
var self = this;
var method = 'get' + this.get('type').capitalize();
this.set('isLoading', true);
this.get('slowService')[method](this.get('project')).then(function(result) {
Ember.run(function() {
self.set('isLoading', false);
});
self.set('data', result);
});
},
Thanks a lot!