Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example PromiseProxyMixin issue
import Ember from 'ember';
const { inject } = Ember;
export default Ember.Controller.extend({
myService: inject.service(),
appName: 'Ember Twiddle',
import Ember from 'ember';
const { run, inject, RSVP: { defer } } = Ember;
export default Ember.Route.extend({
myService: inject.service(),
beforeModel(controller) {
// Load in the background
const deferred = defer('Example Promise');
this.set('myService.promise', deferred.promise);
run.later(() => deferred.resolve("some content"), 1000);
// This seems like it normally wouldn't happen, but it is very common in tests for the application to get destroyed and therefore all objects.
import Ember from 'ember';
export default Ember.Service.extend(Ember.PromiseProxyMixin, {
<h1>PromiseProxyMixin issue</h1>
This example is pretty contrived. Normally, I would see this error in acceptance and integration tests, when a component is rendered that calls a service that uses PromiseProxyMixin, or a controller is initialized that uses PromiseProxyMixin, and the test does not need to wait for all promises so it completes and the app is destroyed before the promise resolves.
Everything is set up in the routes/application. The error is:
Error: Assertion Failed: calling set on destroyed object
Open developer tools to see the error. Comment the last line of `beforeModel` to see PromiseProxyMixin work normally.
{{#if myService.isPending}}
Loaded {{myService.content}}
"version": "0.10.4",
"EmberENV": {
"options": {
"use_pods": false,
"enable-testing": false
"dependencies": {
"jquery": "",
"ember": "2.7.0",
"ember-data": "2.7.0",
"ember-template-compiler": "2.7.0"
"addons": {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.