Hacker News new | ask | show | jobs
by Geee 3936 days ago
How about optimistic over-fetching? On Facebook it's very annoying to wait earlier comments to load when they are fetched like 10 at a time, and there's 5 second latency on every request. Why not fetch everything with a single request (even when they aren't displayed in the current view)?
1 comments

responsibility of the client, no? to dictate how many results to return.
Ugh.. My comment was meant in the Relay thread, but anyway, it sounds like Relay/GraphQL is designed to not fetch anything that isn't actually rendered. In my own SPA apps, I very frequently over-fetch to reduce latency. I was hoping there would be a nice compatible way to manage this use case.

I'm not too familiar how this works, but maybe it's enough to query the additional data in parent component or somewhere and it just works.

To expand on lgas' answer, you can certainly over fetch with Relay/GraphQL if your product needs to.

The intent is to prevent accidental/unintentional over or under fetching that leads to bugs or poor experiences.

It fetches whatever you ask for.