Add Support for Relations without Data so that `loadRelations` can be used to load this data via stored related link · Issue #25 · BlairAllegroTech/js-data-jsonapi · GitHub
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my application we don't always include the relationship data with the primary data object. This causes a problem when I later try to load the related data using DS.loadRelations as it doesn't know what the links are.
The issue is around the test for hasData in JsonApiSerializer.ts. I believe there are two issues here:
Relationships don't always include data key, but we should still add the links to the JSONAPI_META.relationships.
Relationships that are null or an empty array are still valid. For example a User could have a null profile picture before they've added one, and the User might have an empty list of comments because they haven't made any yet.
I've created a branch on my fork to support my work trying to address this issue. If you have any suggestions then I would be happy to discuss. I'll submit a pull request when I have something.