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
You pushed a record of type 'organization' with a relationship 'subscriptions' configured as 'async: false'. You've included a link but no primary data, this may be an error in your payload. EmberData will treat this relationship as known-to-be-empty.
But it's not an error, it's on purpose and it's perfectly legal. When data is not present, it's a violation of JSON:API spec to treat the relationship as known-to-be-empty. It should be treated as unloaded.
Like any synchronous relationship that is unloaded, trying to access it should generate an error, so that the developer realizes they need to either sideload it or use the reference API to fetch it explicitly.
The text was updated successfully, but these errors were encountered:
Unfortunately the reason this is so is because when we improved our JSON:API capabilities a few years ago it turned out a lot of folks were relying on sync relationships without a data member being treated as if they were empty. It's been on my mind to clean that up for some time but it's a "lift" in the sense that it would change the behavior in a negative way for a significant group.
I believe a compounding factor was that a number of popular JSON:API api framework implementations would serialize empty relationships without a data member by default. Some in all cases, some just when a link was possible.
Probably a path forward here would be for the json-api serializer to absorb the cost of adding in an empty data member with a deprecation, while the store would then go by the better expectation (no data member means needs to be loaded).
runspired
changed the title
Sync relationships without data should not be treated as loaded
pre-rfc: Sync relationships without data should not be treated as loaded
Sep 10, 2023
When you have a relationship with:
async: false
link
data
You get the warning:
But it's not an error, it's on purpose and it's perfectly legal. When
data
is not present, it's a violation of JSON:API spec to treat the relationship as known-to-be-empty. It should be treated as unloaded.Like any synchronous relationship that is unloaded, trying to access it should generate an error, so that the developer realizes they need to either sideload it or use the reference API to fetch it explicitly.
The text was updated successfully, but these errors were encountered: