jeudi 17 décembre 2015

Ember update causes promises in templates to not wait to resolve

I'm in the middle of an ember 1.12.1 -> 1.13.11 and ember data 1.0.0-beta.19.1 -> 1.13.15 update. I previously had a template:

{{a-component parent=model.parent}}

and a component

parentChanged: on('init', observer('parent', function() {
  var parent = this.get('parent');
  if (parent) {
    parent.get('child').then(child => {
      this.set('child', child);
    });
  }
}))

This worked previously, but after the update, child is undefined after the then call. I had to change it to

parentChanged: on('init', observer('parent', function() {
  var parent = this.get('parent');
  if (parent) {
    parent.then(parent => {
      parent.get('child').then(child => {
        this.set('child', child);
      });
    });
  }
}))

to get it back to working like before the update.

Does anyone know why this is? It seems like the template stops resolving promises after the update.




Aucun commentaire:

Enregistrer un commentaire