fix(library): Added "LIbrary Failed to Update" content to recover from library load fail

This commit is contained in:
quexeky
2025-01-24 22:35:09 +11:00
parent 53234d283e
commit 76bae3d926
2 changed files with 21 additions and 3 deletions

View File

@ -31,7 +31,7 @@
</ul>
</div>
<div class="grow overflow-y-auto">
<NuxtPage />
<NuxtPage :libraryDownloadError = "libraryDownloadError" />
</div>
</div>
</template>
@ -40,7 +40,19 @@
import { invoke } from "@tauri-apps/api/core";
import { GameStatusEnum, type Game, type NavigationItem } from "~/types";
const rawGames: Array<Game> = await invoke("fetch_library");
let libraryDownloadError = false;
async function calculateGames(): Promise<Game[]> {
try {
return await invoke("fetch_library");
}
catch(e) {
libraryDownloadError = true;
return new Array();
}
}
const rawGames: Array<Game> = 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))

View File

@ -1,3 +1,9 @@
<script setup lang="ts">
const props = defineProps<{ libraryDownloadError: boolean }>();
</script>
<template>
<div v-if="libraryDownloadError" class="mx-auto pt-10 text-center text-gray-500">
Library Failed to update
</div>
</template>