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
Hello, I have an issue with how the relationship objects are implemented. In order to prevent fetching of the same things over and over, i have some global dependencies that are fetched on app load. I store them (via redux in JS, because they are nice and normalized), and afterwards connect them with the object by using the ids. The way that the library is implemented prevents me from doing this. I can see that it was done to speed things up, but there is really no cost of adding the relationship objects as that data is already in the table, i just need the id.
Is this something that can be changed?
The text was updated successfully, but these errors were encountered:
According to JSON API specification, the main use of data member in relationship object is to provide resource linkage in compound documents so you can link the resources within a single JSON document.
Therefore linking the resources between different API calls might lead to data inconsistency (some of the related resources might be deleted in between).
The other downside of your proposition is performance. It is recommended to include all available relationships of a resource in relationships member so that in case a resource has like 10-15 relations and you are requesting a collection of 100 resources then it will be a really heavy operation. Wich I think would be nice to avoid having this as a default behavior of this library.
If you still think that it is a good solution for you. You might try to overwrite this method ResourceTrait::getResourceRelationships so that it will ignore $linked parameter for those models that you consider as global dependencies.
Hello, I have an issue with how the relationship objects are implemented. In order to prevent fetching of the same things over and over, i have some global dependencies that are fetched on app load. I store them (via redux in JS, because they are nice and normalized), and afterwards connect them with the object by using the ids. The way that the library is implemented prevents me from doing this. I can see that it was done to speed things up, but there is really no cost of adding the relationship objects as that data is already in the table, i just need the id.
Is this something that can be changed?
The text was updated successfully, but these errors were encountered: