-
-
Notifications
You must be signed in to change notification settings - Fork 111
Description
Summary
record.changedAttributes() in the adapter is returning the fragment array of the model which was not returned in the older version say 4.0.0
Details
Let's assume a model models/filter.js as
import Model, { attr } from '@ember-data/model';
import { fragmentArray } from 'ember-data-model-fragments/attributes';
export default Model.extend({
name: attr('string'),
conditions: fragmentArray('condition')
})
and the models/condition.js as
import { attr } from '@ember-data/model';
import Fragment from 'ember-data-model-fragments/fragment';
export default Fragment.extend({
field: attr('string'),
predicate: attr('string'),
value: attr()
});
When I try to create a filter record like this
const filter = this.store.createRecord('filter');
filter.set('name', 'Test');
filter.set('conditions', []);
filter.save();
In the adapter we get the changedAttributes by calling record.changedAttributes() and create the payload based on this method's response. And for the fragments we used to check the hasDirtyAttributes property in the fragment to check if this needs to be in the payload or not.
Up until the version 4.0.0 the record.changedAttributes() did not return the conditions property in the object. But after trying out the 5.0.0-beta.0 version, I see that the conditions attribute is returned in the record.changedAttributes() which is breaking our test cases. Is this the intentional behavior going forward?