Partial Relationship Field #4896
60pfennig
started this conversation in
Feature Requests & Ideas
Replies: 1 comment 1 reply
-
Hi, a solution to this was proposed in #2167 (comment), but never implemented. It would be a very helpful feature so hopefully it will be considered for a future update! :) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Relationships are powerfull fields but they are adding tremendous overfetching. For example if you have a link like in the payload demo which relies on referencing to another page the data for every page will get fetched on the page which links to them. Even with maxDepth specified this effect leads to a multiple on API response size.
Another problem is that if you want to reference to for example posts in a post slider you just need a selection of fields which are important for the slider and the overview. You don't need the complete post. This seems to be neglectable but if you hava multiple of relationships and not just posts but bigger data structures this also leads to much bigger API reponses.
To tackle this I think it would be a good idea to have a mapable, partial relationship field. This could get archieved by a optional map attribute which takes a generic function which is called with every selected item of the referenced colletion and returns a type which has the "mandatory" field like id, but the rest is completly flexible. So i could return just the title an the image of a post or the path of the link instead of the complete collection item.
Beta Was this translation helpful? Give feedback.
All reactions