From bab536751ac9bad0785e7245b40b1486684b9dec Mon Sep 17 00:00:00 2001 From: Adorian Doran Date: Fri, 3 Oct 2025 19:22:58 +0300 Subject: [PATCH] website: use a pre-defined GitHub stargazers count outside of SSR --- apps/website/src/github-utils.ts | 4 +++- apps/website/src/index.tsx | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/website/src/github-utils.ts b/apps/website/src/github-utils.ts index b34925ce8..a05839a73 100644 --- a/apps/website/src/github-utils.ts +++ b/apps/website/src/github-utils.ts @@ -1,3 +1,5 @@ +export const FALLBACK_STARGAZERS_COUNT = 31862; // The count as of 2025-10-03 + const API_URL = "https://api.github.com/repos/TriliumNext/Trilium"; /** Returns the number of stargazers of the Trilium's GitHub repository. */ @@ -11,5 +13,5 @@ export async function getRepoStargazersCount() { } } - return 31862; // The count as of 2025-10-03 + return FALLBACK_STARGAZERS_COUNT; } \ No newline at end of file diff --git a/apps/website/src/index.tsx b/apps/website/src/index.tsx index ae1d46a87..10680c4fa 100644 --- a/apps/website/src/index.tsx +++ b/apps/website/src/index.tsx @@ -1,5 +1,5 @@ import './style.css'; -import { getRepoStargazersCount } from './github-utils.js'; +import { FALLBACK_STARGAZERS_COUNT, getRepoStargazersCount } from './github-utils.js'; import { Header } from './components/Header.jsx'; import { Home } from './pages/Home/index.jsx'; import { LocationProvider, Router, Route, hydrate, prerender as ssr } from 'preact-iso'; @@ -26,7 +26,7 @@ export function App(props: {repoStargazersCount: number}) { } if (typeof window !== 'undefined') { - hydrate(, document.getElementById('app')!); + hydrate(, document.getElementById('app')!); } export async function prerender(data) {