danielspaniel / ember-data-change-tracker

extending ember data to track and rollback changes including objects and associations
MIT License
106 stars 47 forks source link

Ember 3.14 #82

Open juggy opened 5 years ago

juggy commented 5 years ago

Hello,

I am getting this error on 3.14 (with ember-data 3.13 and 3.14):

Error: Assertion Failed: You attempted to update [object Object].hasAnyRelationshipData to "true", but it is being tracked by a tracking context, such as a template, computed property, or observer. In order to make sure the context updates properly, you must invalidate the property when updating it. You can mark the property as `@tracked`, or use `@ember/object#set` to do this.
    at assert (index.js:172)
    at ManyRelationship.set [as hasAnyRelationshipData] (index.js:790)
    at ManyRelationship.setHasAnyRelationshipData (-private.js:10663)
    at ManyRelationship.updateRecordDatasFromAdapter (-private.js:10652)
    at ManyRelationship.updateData (-private.js:10999)
    at ManyRelationship.push (-private.js:10704)
    at RecordDataDefault._setupRelationships (-private.js:11532)
    at RecordDataDefault.didCommit (-private.js:11629)
    at InternalModel.adapterDidCommit (-private.js:5961)
    at Store.didSaveRecord (-private.js:14140)

Not tracking the changes on the model fixes it, so it is related to the tracking itself. This happens after a successful save as you can see, when the data is reloaded.

danielspaniel commented 5 years ago

@juggy .. if you have the energy to examine the source of the issue and fix it then please do. I will accept a PR with the fix.

sly7-7 commented 4 years ago

I'm not even sure this is specific to ember-data-tracker. I encounter the same error when using this kind of property in an ember app

get notification() {
   return user.hasMany('fileTransferNotifications').value().firstObject;
}

end reloading the user.