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

This commit is contained in:
Elian Doran 2025-09-28 00:16:51 +03:00
parent 9274522877
commit 7386bb35e5
No known key found for this signature in database
2 changed files with 5 additions and 3 deletions

View File

@ -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);

View File

@ -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 (