-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sync relationships clearing when links are present #5866
Comments
We restored a behavior true prior to 2.18 that we had unknowingly eliminated (hadn't been a guarantee and had no test coverage, basically wasn't a known case, just one that happened to exist a long time). Basically, if a relationship is I think what you are finding here is that this is at odds with being able to "update the links" associated with a relationship, although I am a bit surprised that a relationship might be established without a link and later receive one... |
Thanks for getting back to so quickly, appreciate that! Both of the payloads have links, but that payload that made a request with jsonapi includes also had data. The backend application I work on uses a json:api library that always includes links, for requests made with and without includes. Assuming the relationship is empty makes sense to me, but I'm wondering if we could expand the logic a little. Would you accept a PR that did...
Let me know, happy to tackle this one. PS: Code sandbox crashes a lot with Ember apps - if the link it's working let me know and I can fix it (by rebooting the sandbox until it comes back :D ) |
The proposed change seems good to me, especially if tests accompany it <3 |
Woohoo! I just updated the test app I was using to reproduce the original issue with Closing this, see #5880 |
I think I'm running into some unexpected behavior with sync relationships that have links.
When I push a sync relationship with links into the store the relationship is emptied with a
known-to-be-empty
warning. If my model has related data, then that related data is being unset.Reproduction
Here's a GH repo that shows a simplified version of what I'm seeing: https://github.com/ryanto/ember-data-sync-relationship-clear
I created a code sandbox for this repo: https://codesandbox.io/s/k9n7qz1k5r
Description
This behavior looks like it was changed in 3.2, on 3.1 the relationship is not cleared.
I think I would expect the
known-to-be-empty
warning to not be shown if Ember Data does know about the model having a relationship.Versions
Thanks!
The text was updated successfully, but these errors were encountered: