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://starqa.fmr.com/assets/vendor.js:22615:21) at Object.Ember.default.assert (http://starqa.fmr.com/assets/vendor.js:15716:13) at Object.set (http://starqa.fmr.com/assets/vendor.js:26367:22) at exports.default.mixin.Mixin.create.set (http://starqa.fmr.com/assets/vendor.js:41034:20) at Ember.Object.extend.flushCanonical (http://starqa.fmr.com/assets/vendor.js:69769:14) at ember$data$lib$system$relationships$state$has_many$$ManyRelationship.flushCanonical (http://starqa.fmr.com/assets/vendor.js:71525:22) at Queue.invoke (http://starqa.fmr.com/assets/vendor.js:11425:18) at Object.Queue.flush (http://starqa.fmr.com/assets/vendor.js:11490:13) 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.