Revert "perf(website): avoid blocking root render on GitHub"

This reverts commit 89a500cd3e.
This commit is contained in:
Mohamed Boudra
2026-05-07 23:10:26 +07:00
parent 90fe71bd54
commit 90bf6571d6
2 changed files with 13 additions and 59 deletions
+2 -26
View File
@@ -11,11 +11,6 @@ function formatStars(count: number): string {
}
const GITHUB_REPO_URL = "https://api.github.com/repos/getpaseo/paseo";
const STAR_REFRESH_MS = 60_000;
let cachedStars = "";
let cachedStarsAt = 0;
let refreshStarsPromise: Promise<void> | null = null;
async function fetchStarCount(): Promise<string> {
try {
@@ -39,26 +34,7 @@ async function fetchStarCount(): Promise<string> {
}
}
function refreshStarCount(): Promise<void> {
refreshStarsPromise ??= fetchStarCount()
.then((stars) => {
if (stars) {
cachedStars = stars;
cachedStarsAt = Date.now();
}
return undefined;
})
.finally(() => {
refreshStarsPromise = null;
});
return refreshStarsPromise;
}
export const getStarCount = createServerFn({ method: "GET" }).handler(async () => {
if (Date.now() - cachedStarsAt > STAR_REFRESH_MS) {
void refreshStarCount();
}
return { stars: cachedStars };
const stars = await fetchStarCount();
return { stars };
});