-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
fix(kitsu-core): fix inability to link relationship links on circular resources #699
fix(kitsu-core): fix inability to link relationship links on circular resources #699
Conversation
Even though it passed as-is, I think it's a good idea to keep the test as it's extra redundency to protect against regressions
The code path is either:
|
Co-authored-by: James Harris <wopian@wopian.me>
Code Climate has analyzed commit 0d55779 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (100% is the threshold). This pull request will bring the total coverage in the repository to 100.0% (0.0% change). View more on Code Climate. |
@wopian Turns out i spoke too soon regarding the array case. I'll go squash the commits in preparation for the merge when you give the OK |
You don't need to squash the commits, the PR merge itself squashes them 👍
Good spot! D: |
Thank you! 🎉 |
Released in 10.0.0-alpha.26 |
Before this fix, this error would occasionally pop up
When serializing a resource with a once removed relationship to itself (A -> B -> A).
The problem seems to stem from same origin as this issue #579, where a
relationships
object is deleted before subsequent objects with references to it has had a change to read itThe simple solution would be to add safe navigation to the
if
statement, but thenmeta
andlinks
would be lost on any subsequent inclusions of the resource.I was unable to reproduce this issue with array resource linkages, so only
linkObject
was modified. I have a feeling it might be due to something relating to pass-by-value/pass-by-reference. I wrote a spec for it, and it passed without modification, so i just removed it again. I can add it back if you think it would be relevantI'm very open to style changes or suggestions for alternate implementations