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
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
Ah, alright bro, thanks for quick response! I was also wondering about those performance issues prefetching too many items at once!
the best possible is only client fetching
gssp delay is wayy to big overall
Yup, was thinking about most of the things with gssp, but prolly I don't even have enough cpu power on my nodes lol
next is heavy already
a snipper isnt bad
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
prefetch the first 10 on clients, and later on client
but overall isnt a good pattern