Files
supabase/apps/docs/features/helpers.fetch.ts
Charis 9fb97becb9 fix: revalidate fetches every day (#27828)
The Vercel Data Cache caches data across deployments, and we want to
check for updates in federated content, so let's revalidate the data
once a day.

It may be more efficient to revalidate on-demand, since we don't change
most of these sources once a day, but that requires setting up an API
endpoint (and figuring out how to authenticate it), so this is
quick-and-easy for now.
2024-07-08 13:12:19 -04:00

18 lines
564 B
TypeScript

/**
* Next.js extends native `fetch` with revalidation options.
*
* This module provides some reusable utility functions to set revalidation
* options for `fetch`, for example when it needs to be passed to a
* third-party API.
*/
import { ONE_DAY_IN_SECONDS } from './helpers.time'
function fetchWithNextOptions(options: NextFetchRequestConfig) {
return (info: RequestInfo) => fetch(info, { next: options })
}
const fetchRevalidatePerDay = fetchWithNextOptions({ revalidate: ONE_DAY_IN_SECONDS })
export { fetchWithNextOptions, fetchRevalidatePerDay }