fix(global_menu): uncaught exception if update request fails (closes #5700)

This commit is contained in:
Elian Doran 2025-11-20 19:52:13 +02:00
parent d51e3de674
commit 165357f444
No known key found for this signature in database

View File

@ -221,9 +221,15 @@ function useTriliumUpdateStatus() {
async function updateVersionStatus() {
const RELEASES_API_URL = "https://api.github.com/repos/TriliumNext/Trilium/releases/latest";
const resp = await fetch(RELEASES_API_URL);
const data = await resp.json();
const latestVersion = data?.tag_name?.substring(1);
let latestVersion: string | undefined = undefined;
try {
const resp = await fetch(RELEASES_API_URL);
const data = await resp.json();
latestVersion = data?.tag_name?.substring(1);
} catch (e) {
console.warn("Unable to fetch latest version info from GitHub releases API", e);
}
setLatestVersion(latestVersion);
}