Next.js Discord

Discord Forum

Prefetching and API calls with server components

Unanswered
Taiwan Dog posted this in #help-forum
Open in Discord
Taiwan DogOP
With the new pattern of server components fetching their data directly instead of using serverside props, that means that when Links prefetch pages, they also call any API that might be called serverside, which seems like an easy way to run up costs - In my case we're calling several ecommerce APIs to get product data/prices/etc, and those APIs charge us per request. Is this intended? Is it avoidable without disabling prefetching entirely?

1 Reply

Yacare Caiman
You can add props prefetch={false} to Link component