Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
website: use a pre-defined GitHub stargazers count outside of SSR
Adorian Doranbab536751ac9
diff --git a/apps/website/src/github-utils.ts b/apps/website/src/github-utils.tsindex b34925ce8d..a05839a736 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 filediff --git a/apps/website/src/index.tsx b/apps/website/src/index.tsxindex ae1d46a87d..10680c4fa5 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(<App repoStargazersCount={1000} />, document.getElementById('app')!);+ hydrate(<App repoStargazersCount={FALLBACK_STARGAZERS_COUNT} />, document.getElementById('app')!);}export async function prerender(data) {