by 0-bad-secrotrs · 2y ago · 0 comments
Are you proposing just to add new field to a JSON response, even though they are not needed?
(Most) GraphQL clients are optimized for relatively small/simple objects being returned, and you typically pay a cost for every single edge (not node) returned in a response / cached in memory.
It can quickly get to the point where your project is spending more time per frame processing GraphQL responses & looking data up from the cache than you spend rendering your UI
The only downside is if one of those unused fields changes due to a mutation then all components using that field will rerender (ofc I'm assuming React here). Again, not the biggest concern if you've got your memoization set up correctly
Overfetching or not, that's a rather big difference.
Surely there are some good use cases.. just so few and far between. No one should be using GraphQL unless absolutely necessary.