Free & Open-Source Invoice Generator - No Sign-Up, No Ads, Instant PDF Export, 100% In-Browser, and Fully Customizable Templates.
TypeScript fintechinvoiceinvoice-generatorinvoice-pdfinvoice-templateinvoicesnextjsopen-sourcequotesreactreact-pdf-rendererself-hostedshadcn-uitailwindcsstypescript
feat: add server-side revalidation for GitHub stars fetch function + rename file
VladSezcf0b2d6114d2
diff --git a/src/actions/fetch-github-starts.ts b/src/actions/fetch-github-stars.tssimilarity index 87%rename from src/actions/fetch-github-starts.tsrename to src/actions/fetch-github-stars.tsindex 78ac9d0..2aace45 100644--- a/src/actions/fetch-github-starts.ts+++ b/src/actions/fetch-github-stars.ts@@ -1,3 +1,5 @@+"use server";+import { env } from "@/env";export async function fetchGithubStars(): Promise<number> {@@ -8,6 +10,7 @@ export async function fetchGithubStars(): Promise<number> {headers: {Authorization: `Bearer ${env.GITHUB_TOKEN}`,},+ next: { revalidate: 1800 }, // 30 minutes in seconds},);diff --git a/src/app/(app)/page.tsx b/src/app/(app)/page.tsxindex 2e1f4e9..187898c 100644--- a/src/app/(app)/page.tsx+++ b/src/app/(app)/page.tsx@@ -1,7 +1,7 @@import type { Metadata } from "next";import { AppPageClient } from "./page.client";import { APP_URL, STATIC_ASSETS_URL } from "@/config";-import { fetchGithubStars } from "@/actions/fetch-github-starts";+import { fetchGithubStars } from "@/actions/fetch-github-stars";// we generate metadata here, because we need access to searchParams (in layout we don't have it)export async function generateMetadata({