From 17e0494383f4bf3e5af8b09882a960a073f6aeb4 Mon Sep 17 00:00:00 2001 From: HoraceHyy Date: Sat, 3 Feb 2024 17:16:17 +0800 Subject: [PATCH] fix: added dead loop protection for refreshing Genshin cache --- src/pages/GenshinPage/Components/GenshinInfoCard.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/GenshinPage/Components/GenshinInfoCard.vue b/src/pages/GenshinPage/Components/GenshinInfoCard.vue index 28f159f6..c1552785 100644 --- a/src/pages/GenshinPage/Components/GenshinInfoCard.vue +++ b/src/pages/GenshinPage/Components/GenshinInfoCard.vue @@ -32,6 +32,7 @@ const playerInfoFailed = ref(false) const charsScrollbar = ref() const showcaseIdx = ref(0) const showCostume = ref(false) +const retriedCache = ref(false) const elementAssets = { cryo: { bg: '../../src/assets/elementBgs/cryo.png', @@ -151,9 +152,11 @@ const requestInfo = () => { }) }).catch((err) => { console.error(err) - if (err.toString().startsWith('Error: Error invoking remote method \'enka:getGenshinPlayer\': AssetsNotFoundError:')) { + if (err.toString().startsWith('Error: Error invoking remote method \'enka:getGenshinPlayer\': AssetsNotFoundError:') && !retriedCache.value) { + retriedCache.value = true window.enka.updateCache().then(requestInfo) } else { + retriedCache.value = false playerInfoLoading.value = false playerInfoFailed.value = true }