Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

3
Are colocated queries a lie?
Post Flair (click to view more posts with a particular flair)
Post Body

My app uses Apollo and I keep seeing this problem come up, where two distant components need to query the same entities but different fields in those entities. If each component queries for only what it needs, then caching is ineffective because neither component can reuse the results of the other's queries due to missing fields. On the other hand, if I combine these queries into one and force both components to fetch everything the other needs, my components become coupled and I may be fetching unnecessary data. I may even have to move the query to a higher level component to guarantee it only happens once. At least on the client, it starts to look like an RPC API where I have one query to fetch each kind of entity and it always fetches everything. I don't see any alternative, but this seems to go against the best practice of making components directly query only for what they need, and we keep running into this problem when we follow that advice. Is there a better philosophy for organizing our queries, components, and data to use the cache and query efficiently without excessive coupling between components?

Author
Account Strength
100%
Account Age
17 years
Verified Email
Yes
Verified Flair
No
Total Karma
9,433
Link Karma
599
Comment Karma
8,736
Profile updated: 2 days ago
Posts updated: 2 weeks ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
1 year ago