Skip to content

Build your personal knowledge base with Trilium Notes

fix(website): yet another case of server-side rendering failing

Elian Doran7386bb35e537
diff --git a/apps/website/src/download-helper.ts b/apps/website/src/download-helper.ts
index 2e153f04c6..4d427ae8b3 100644
--- a/apps/website/src/download-helper.ts
+++ b/apps/website/src/download-helper.ts
@@ -181,7 +181,9 @@ export function buildDownloadUrl(app: App, platform: Platform, format: string, a
}
}
-export function getArchitecture(): Architecture {
+export function getArchitecture(): Architecture | null {
+ if (typeof window === "undefined") return null;
+
const userAgent = navigator.userAgent.toLowerCase();
if (userAgent.includes('arm64') || userAgent.includes('aarch64')) {
return 'arm64';
@@ -208,7 +210,7 @@ export function getRecommendedDownload() {
const architecture = getArchitecture();
const platform = getPlatform();
- if (!platform) return null;
+ if (!platform || !architecture) return null;
const downloadInfo = downloadMatrix.desktop[platform]?.downloads;
const recommendedDownload = Object.entries(downloadInfo || {}).find(d => d[1].recommended);
diff --git a/apps/website/src/pages/GetStarted/get-started.tsx b/apps/website/src/pages/GetStarted/get-started.tsx
index bce0ac373e..b22546f272 100644
--- a/apps/website/src/pages/GetStarted/get-started.tsx
+++ b/apps/website/src/pages/GetStarted/get-started.tsx
@@ -10,7 +10,7 @@ import "./get-started.css";
import packageJson from "../../../../../package.json" with { type: "json" };
export default function DownloadPage() {
- const [ currentArch, setCurrentArch ] = useState(getArchitecture());
+ const [ currentArch, setCurrentArch ] = useState(getArchitecture() ?? "x64");
usePageTitle("Download");
return (