From 26a3dd7338015eb3b25ea1c86e42fbe141e229f5 Mon Sep 17 00:00:00 2001 From: quexeky <116044207+quexeky@users.noreply.github.com> Date: Fri, 24 Jan 2025 22:35:09 +1100 Subject: [PATCH] fix(library): Added "LIbrary Failed to Update" content to recover from library load fail --- desktop/pages/library.vue | 16 ++++++++++++++-- desktop/pages/library/index.vue | 8 +++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/desktop/pages/library.vue b/desktop/pages/library.vue index 925addba..ab5079af 100644 --- a/desktop/pages/library.vue +++ b/desktop/pages/library.vue @@ -31,7 +31,7 @@
- +
@@ -40,7 +40,19 @@ import { invoke } from "@tauri-apps/api/core"; import { GameStatusEnum, type Game, type NavigationItem } from "~/types"; -const rawGames: Array = await invoke("fetch_library"); +let libraryDownloadError = false; + +async function calculateGames(): Promise { + try { + return await invoke("fetch_library"); + } + catch(e) { + libraryDownloadError = true; + return new Array(); + } +} + +const rawGames: Array = await calculateGames(); const games = await Promise.all(rawGames.map((e) => useGame(e.id))); const icons = await Promise.all( games.map(({ game, status }) => useObject(game.mIconId)) diff --git a/desktop/pages/library/index.vue b/desktop/pages/library/index.vue index 61c7765c..dd245b63 100644 --- a/desktop/pages/library/index.vue +++ b/desktop/pages/library/index.vue @@ -1,3 +1,9 @@ + \ No newline at end of file