Prefetching more items than requested on client side

Hey guys, I was wondering about prefetching a long list of items (100) with getServerSideProps, but then - user will request just 10 of them on every page. Is that actually going to work and take 10 items of prefetched 100 every time? Or prefetch query has to be exactly the same as user query? I.e. if 100 items got prefetched then user also has to fetch 100 in order to make use of prefetch feature?
7 Replies
Neto
Neto2y ago
dont prefetch that many the bigger payload + serialization will tank the performance of the page its ok to prefetch (gssp) the first 10, then use client side to prefetch the other ones
cement4357
cement4357OP2y ago
Ah, alright bro, thanks for quick response! I was also wondering about those performance issues prefetching too many items at once!
Neto
Neto2y ago
the best possible is only client fetching gssp delay is wayy to big overall
cement4357
cement4357OP2y ago
Yup, was thinking about most of the things with gssp, but prolly I don't even have enough cpu power on my nodes lol
Neto
Neto2y ago
next is heavy already a snipper isnt bad
cement4357
cement4357OP2y ago
So far I was using regular client-side queries and it was pretty much very fast, you mentioned prefetching on the client-side - what exactly did you mean? Would be nice to prefetch more queries if previous one is already loaded! Don't really see any prefetch extension on my components using trpc I wanted to create something like a step ahead of user - so one more query would be always prefetched
Neto
Neto2y ago
prefetch the first 10 on clients, and later on client but overall isnt a good pattern
Want results from more Discord servers?
Add your server