ember-parse-adapter
ember-parse-adapter copied to clipboard
Add tests for addition and removal from a hasMany relationship
Refactor serializeHasMany
to be simpler and more correct. Enable a test for adding to a hasMany, add a test for removal from a hasMany.
I'm not convinced the conditionals in the serializeHasMany
function are correct. The items iterated for the add operation seem to just be all items in the relationship. The property iterated for the deletion operation I believe is never set (hence the failing test). I think we need some other method to see changes to the relationship instead of just checking its current state during serialization.
/cc @igorT
I wonder why this would work. I see there that hasMany._deletedItems
is used to track models removed from hasMany relationship, but when I search deletedItems
in Ember Parse Adapter, Ember Data, Ember and Parse JS SDK, I got 0 results. So where is hasMany._deletedItems
being set?
@lacek _deletedItems may have been an old, old Ember-Data thing. There has been some recent work by @igorT that may bring something similar back, but I think we are stalled until we can get the feature re-introduces upstream.
For that matter, I'm not sold that the original code worked exactly as you would expect it to. I think it sent create operations for relationships that already existed when saving a record.
@mixonic _deletedItems
is not Ember Data stuff, it originates from this project and is removed in #21 by you for some reason.
Do we have any plan to merge this stuff?
The reason this pull request contains merge conflicts that must be resolved, beyond the obvious understanding of what that means, is because https://github.com/clintjhill/ember-parse-adapter/pull/54 converted this library into an Ember CLI Addon. That means that the structure of the library this pull request was written against no longer exists and the changes will need to be applied to the new code locations.
Any plans on fixing this? Be it the author or the maintainers? This is a huge issue, as removed items don't... get removed. Refs #75.