@andrew1 wrote:
I'm fixing a bug in some code that -- unfortunately -- uses the
store
in a component:store: Ember.inject.service(), this.get('store').query('foo'...).then((data) => this.set('data', data))
Now, if the promise resolves after the component has been destroyed, we get an error about calling set on a destroyed object. So far, I've tried:
this.get('store').query...then((data) => if (this.isDestroyed || this.isDestroying) { return }...
which works but I think it's much better for the component to clean up after itself in the
willDestroyElement
hook.So, how can I note the xhr request from
this.get('store').query..
so that I can abort it inwillDestroyElement
?Thanks!
Posts: 2
Participants: 2