Saving a record and using "includes"?

#1

Hi everyone, I need a little help with something.

I’m using EmberJS 3.5, Ember Data 3.7 and Ember CLI 3.7

I have a model with lots of relations (hasMany and belongsTo). The backend sends some of the relations included by default when I load the model using findRecord, but in the edit form I want to load them all so I load the model on my route model() hook with the following code:

model({ id }) {
   return this.store.findRecord('my-model-name', id, {
        include: 'relation1,relation2,relation3.......relationN' //really long chain of relations
   }
}

When I save the relation using an ember concurrency-task I just do:

let { model } = this;
yield model.save();

What happens is the backend saves the model, but then returns back the saved item with only the items that are usually included by default (and missing the ones that were included in the model() hook, which essentially “wipes” some of the values that were just been saved from the client (if I refresh the page without saving again, everything is there).

I would assume, I would want to do something like model.save({include: 'include-all-again'}) but that doesn’t seem to work (also tried with .save({adapterOptions: {include: 'include-all-again'}}))

Currently what I’m doing to overcome this is (reloading the model again after saving):

let { model } = this;
yield model.save();
yield this.store.findRecord('my-model-name', model.id, { include: 'include-all-relations' });

This doesn’t seem what I would want, anyone can point in me the right direction of this?