Skip to content

Commit bab5367

Browse files
committed
website: use a pre-defined GitHub stargazers count outside of SSR
1 parent 7657e17 commit bab5367

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

apps/website/src/github-utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
export const FALLBACK_STARGAZERS_COUNT = 31862; // The count as of 2025-10-03
2+
13
const API_URL = "https://api.github.com/repos/TriliumNext/Trilium";
24

35
/** Returns the number of stargazers of the Trilium's GitHub repository. */
@@ -11,5 +13,5 @@ export async function getRepoStargazersCount() {
1113
}
1214
}
1315

14-
return 31862; // The count as of 2025-10-03
16+
return FALLBACK_STARGAZERS_COUNT;
1517
}

apps/website/src/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import './style.css';
2-
import { getRepoStargazersCount } from './github-utils.js';
2+
import { FALLBACK_STARGAZERS_COUNT, getRepoStargazersCount } from './github-utils.js';
33
import { Header } from './components/Header.jsx';
44
import { Home } from './pages/Home/index.jsx';
55
import { LocationProvider, Router, Route, hydrate, prerender as ssr } from 'preact-iso';
@@ -26,7 +26,7 @@ export function App(props: {repoStargazersCount: number}) {
2626
}
2727

2828
if (typeof window !== 'undefined') {
29-
hydrate(<App repoStargazersCount={1000} />, document.getElementById('app')!);
29+
hydrate(<App repoStargazersCount={FALLBACK_STARGAZERS_COUNT} />, document.getElementById('app')!);
3030
}
3131

3232
export async function prerender(data) {

0 commit comments

Comments
 (0)