TanStackT
TanStack9mo ago
4 replies
inadequate-blush

ISR and data fetching

Hi!
I noticed on the TanStack website that you’ve implemented something similar to ISR (Incremental Static Regeneration) using CDN headers, like this:

headers: (ctx) => {
return {
'cache-control': 'public, max-age=0, must-revalidate',
'cdn-cache-control': 'max-age=300, stale-while-revalidate=300, durable',
}
}
What I’m trying to achieve is this:

I have an external API that I want to call only once per day. After that, I want the result to be cached at the CDN level and used like an ISR response for any future requests.

The problem I’m running into is that when navigating on the client side , the loaders run on the client, which means:

Extra requests may be made directly from the browser.

The client-side data may differ from the server/CDN cached version.

what can I do
Was this page helpful?