Skip to content

Commit

Permalink
chore: use unstable cache
Browse files Browse the repository at this point in the history
  • Loading branch information
icco committed Oct 27, 2024
1 parent 2653c52 commit fdfaafc
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Metadata } from "next";
import { unstable_cache } from "next/cache";

import { BlogPost } from "@/components/BlogPost";
import { Header, Size } from "@/components/Header";
Expand All @@ -9,8 +10,16 @@ export const metadata: Metadata = {
title: "Nat Welch",
};

const getLatest = unstable_cache(
async () => {
return await getLatestBlogPost();
},
["blog"],
{ revalidate: 3600, tags: ["blog"] }
);

export default async function Page() {
const post = await getLatestBlogPost();
const post = await getLatest();

return (
<div className="flex flex-col items-center justify-center my-[14vh]">
Expand Down

0 comments on commit fdfaafc

Please sign in to comment.