Next.js Discord

Discord Forum

Home Page Revalidation

Unanswered
American posted this in #help-forum
Open in Discord
AmericanOP
I am struggling with formating my home page to have either Dynamic data (revalidation of 0) or a minutely one. Here is my code:
import { supabaseServer } from "@/lib/supabaseServer";

const home = async () => {
  const totalUsers = (
    await supabaseServer
      .from("users")
      .select("*", { count: "exact", head: true })
  ).count;
  const totalQuestions = (
    await supabaseServer
      .from("question")
      .select("*", { count: "exact", head: true })
  ).count;
  const totalPapers = (
    await supabaseServer
      .from("paper")
      .select("*", { count: "exact", head: true })
  ).count;

  return (
    <div className="flex flex-col items-center justify-center py-2 space-y-4">
      <h1 className="text-4xl font-bold text-gray-800">Welcome!</h1>
      <h3 className="text-lg font-bold text-gray-700">
        Trusted by over {totalUsers} users with {totalQuestions} approved
        questions and {totalPapers} approved papers.
      </h3>
    </div>
  );
};

export default home;

I have tried many diffrent methods and none of them work in my dev enviroment, how can I get this to revalidate every 60 seconds?

2 Replies

New Zealand Heading Dog
If I understand what you are asking, correctly, then this article should help with your issue: https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config
AmericanOP
I will give it a look - thanks 🙂