revalidatePost() — supabase Function Reference
Architecture documentation for the revalidatePost() function in revalidatePost.ts from the supabase codebase.
Entity Profile
Relationship Graph
Source Code
apps/cms/src/collections/Posts/hooks/revalidatePost.ts lines 7–38
export const revalidatePost: CollectionAfterChangeHook<Post> = async ({
doc,
previousDoc,
req: { payload, context },
}) => {
if (!context.disableRevalidate) {
if (doc._status === 'published') {
const path = `/posts/${doc.slug}`
payload.logger.info(`Revalidating post at path: ${path}`)
try {
const { revalidatePath, revalidateTag } = await import('next/cache')
revalidatePath(path)
revalidateTag('posts-sitemap')
} catch {}
}
// If the post was previously published, we need to revalidate the old path
if (previousDoc._status === 'published' && doc._status !== 'published') {
const oldPath = `/posts/${previousDoc.slug}`
payload.logger.info(`Revalidating old post at path: ${oldPath}`)
try {
const { revalidatePath, revalidateTag } = await import('next/cache')
revalidatePath(oldPath)
revalidateTag('posts-sitemap')
} catch {}
}
}
return doc
}
Domain
Subdomains
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free