"use client"; import { useState, useTransition } from "react"; import { useRouter } from "next/navigation"; import { RefreshCw, CheckCircle2 } from "lucide-react"; import { clearCache } from "@/app/actions/maintenance"; export function ClearCacheButton() { const [done, setDone] = useState(false); const [pending, start] = useTransition(); const router = useRouter(); const onClick = () => { start(async () => { await clearCache(); router.refresh(); setDone(true); setTimeout(() => setDone(false), 1600); }); }; return (
Clear Cache
Drop the in-memory settings cache and force every page to re-fetch from the database. Useful if data looks stale after a manual edit.
{done ? ( Cleared ) : ( )}
); }