mirror of
https://github.com/supabase/supabase.git
synced 2026-10-14 21:59:16 +03:00
* Bump all versions of postcss to 8.5.3. * Run next/codemod on the docs app. * Move two experimental flags into stable. Add next-mdx-remote as a transpiled package. * Add extra folders to the clean command in docs. * Fix type errors in docs test. * Run prettier on the new files. * remove turbopack, fix fetch revalidation, fix metadata awaits Couple of minor fixes: - Turbopack doesn't work in dev because of known MDX loader limitations (cannot load functions in MDX plugin config) - Fetches not cached by default anymore in Next 15 so need to manually cache the ones we need - Missing a few awaits for metadata generation with page params * Bump the graphiql version because headlessui/react is not building with Next 15. --------- Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com>
37 lines
994 B
TypeScript
37 lines
994 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'
|
|
|
|
export const REVALIDATION_TAGS = {
|
|
GRAPHQL: 'graphql',
|
|
WRAPPERS: 'wrappers',
|
|
} as const
|
|
// Casting to avoid problems with using this as a Zod enum, TypeScript does
|
|
// not recognize the casted type as a supertype of the original type
|
|
export const VALID_REVALIDATION_TAGS = Object.values(REVALIDATION_TAGS) as unknown as readonly [
|
|
string,
|
|
...string[],
|
|
]
|
|
|
|
function fetchWithNextOptions({
|
|
next,
|
|
cache,
|
|
}: {
|
|
next?: NextFetchRequestConfig
|
|
cache?: RequestInit['cache']
|
|
}) {
|
|
return (info: RequestInfo) => fetch(info, { next, cache })
|
|
}
|
|
|
|
const fetchRevalidatePerDay = fetchWithNextOptions({
|
|
next: { revalidate: ONE_DAY_IN_SECONDS },
|
|
})
|
|
|
|
export { fetchWithNextOptions, fetchRevalidatePerDay }
|