I have updated to the latest 3.x version of Ember and have got ember-data version 3.28.7. In older versions of Ember (3.20) calling the becomeDirty action on a model set hasDirtyAttributes to true on that model, but in 3.28.7 of ember-data observers that monitor hasDirtyAttributes on a list of models are triggered, but the actual value of hasDirtyAttributes in the model seems to be false.
Has anyone else seen this? I cannot find any links to people having this same issue?
I should say I am using classic Ember objects: Model.extend({})
I get the following results with the following commands:
model.hasDirtyAttributes // false
model._internalModel.currentState.isDirty // true
Looking in @ember-data, it looks like when getting the @tagged currentState it returns this.___recordState instead of the this._internalModel.currentState because CUSTOM_MODEL_CLASS is defined? (Whatever that means.) Anyway the result of the state object thing seems to be false:
model.___recordState.isDirty // false
Why isn't that set to true? Investigating more...
It looks like a lot of things called canary-features have been enabled. In the old version of @ember-data a configuration file looked like:
export default {
SAMPLE_FEATURE_FLAG: null,
RECORD_DATA_ERRORS: null,
RECORD_DATA_STATE: null,
IDENTIFIERS: true,
REQUEST_SERVICE: null,
CUSTOM_MODEL_CLASS: null,
FULL_LINKS_ON_RELATIONSHIPS: true,
};
but now it looks like:
export default {
SAMPLE_FEATURE_FLAG: null,
RECORD_DATA_ERRORS: true,
RECORD_DATA_STATE: true,
IDENTIFIERS: true,
REQUEST_SERVICE: true,
CUSTOM_MODEL_CLASS: true,
FULL_LINKS_ON_RELATIONSHIPS: true,
RECORD_ARRAY_MANAGER_IDENTIFIERS: true,
REMOVE_RECORD_ARRAY_MANAGER_LEGACY_COMPAT: true,
};
And if I hardcode CUSTOM_MODEL_CLASS to be false things seem to be working again. So now I need to figure out the best way of turning this stuff off without editing node_modules files.
Anyone know if just setting CUSTOM_MODEL_CLASS to false is OK or should I turn off other things?
Aucun commentaire:
Enregistrer un commentaire