From 77e55e750f9b86b8833693461b71b30b52d85e84 Mon Sep 17 00:00:00 2001 From: Thomas Camlong Date: Wed, 1 Oct 2025 18:23:05 +0200 Subject: [PATCH] feat(web): add cache revalidation utilities Add server-side utilities for cache revalidation using Next.js revalidatePath and revalidateTag. Provides functions to revalidate community page and all submission-related pages after data changes --- web/src/lib/revalidate.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 web/src/lib/revalidate.ts diff --git a/web/src/lib/revalidate.ts b/web/src/lib/revalidate.ts new file mode 100644 index 00000000..247dc7ff --- /dev/null +++ b/web/src/lib/revalidate.ts @@ -0,0 +1,22 @@ +"use server" + +import { revalidatePath, revalidateTag } from "next/cache" + +/** + * Revalidate the community page cache + * Can be called from server actions after submission approval/rejection + */ +export async function revalidateCommunityPage() { + revalidatePath("/community") + revalidateTag("community-gallery") +} + +/** + * Revalidate all submission-related caches + */ +export async function revalidateSubmissions() { + revalidateTag("community-gallery") + revalidatePath("/community") + revalidatePath("/dashboard") +} +