mardi 4 décembre 2018

Ember reloating belongsTo relationship

I have a belongsTo relationship defined in the model, e.g.

gallery: DS.belongsTo('store-gallery', { async: true }),

Later on, I'll create a new object and assign it to the relationship if it is null:

let galleryObject = this.get('store').createRecord('store-gallery', {}); this.set('gallery', galleryObject); console.log('Created', galleryObject, await this.get('gallery'));

The problem is that the this.get('gallery') call returns NULL due to Ember reloading the relationship.

How do I set the relationship (preferrably without having to convert it to non-async) without it immediately overwriting it?




Aucun commentaire:

Enregistrer un commentaire