Next.js Discord

Discord Forum

cache vs cache: private

Unanswered
Finnish Lapphund posted this in #help-forum
Open in Discord
Original message was deleted.

1 Reply

Finnish Lapphund
export const getLatestClaims = async () => {
  "use cache: private";
  cacheLife({
    stale: 1200,
    revalidate: 1200,
    expire: 1200,
  });
  cacheTag("latest-claims");

  const supabase = await createClient();
  const { data, error } = await supabase.rpc("get_latest_claims");

  if (error) {
    throw error;
  }

  return data;
};


import { getLatestClaims } from "@/lib/supabase/models/faucet";
import dynamic from "next/dynamic";

const EarningsHistoryTable = dynamic(
  () => import("@/components/table/earnings-history-table")
);

const LatestClaims = async () => {
  const data = await getLatestClaims();
  return <EarningsHistoryTable data={data} />;
};
export default LatestClaims;


// in page.tsx
<Suspense fallback={<TableSkeleton />}>
  <LatestClaims />
</Suspense>