I have this route that currently, when I transition back to it, gives me this great big error with a stack trace that doesn't help me figure out what is going wrong.
Error while processing route: project.details Assertion Failed: calling set on destroyed object Error: Assertion Failed: calling set on destroyed object at new Error (native) at Error.EmberError (http://ift.tt/1jDSJnk) at Object.Ember.default.assert (http://ift.tt/1NJLaIZ) at Object.set (http://ift.tt/1jDSJno) at exports.default.mixin.Mixin.create.set (http://ift.tt/1NJLcAD) at Ember.Object.extend.flushCanonical (http://ift.tt/1jDSLM3) at ember$data$lib$system$relationships$state$has_many$$ManyRelationship.flushCanonical (http://ift.tt/1NJLcAG) at Queue.invoke (http://ift.tt/1jDSLM5) at Object.Queue.flush (http://ift.tt/1NJLaJ7) at Object.DeferredActionQue
Through just going through my routes and commenting out stuff, I found this in my projects route:
export default Ember.Route.extend(AuthenticatedRouteMixin, {
model: function(params) {
if (params.q) {
return this.store.find('project', params);
} else {
var _this = this;
Ember.run(function() {
_this.store.unloadAll('project');
});
return this.store.findAll('project', {reload: true});
}
}
And if I comment out lines 7-9:
/*
Ember.run(function() {
_this.store.unloadAll('project');
});
*/
then the error goes away and the transition worked. This bit of code was written by somebody else, and I think it has to do with refreshing the model from the store, but I can't figure out why it would cause this "calling set on a destroyed object" error.
Any help would be greatly appreciated.
Aucun commentaire:
Enregistrer un commentaire