Skip to content

Commit

Permalink
Merge pull request #50 from HoraceHuang-ui/horace_dev
Browse files Browse the repository at this point in the history
fix: added dead loop protection for refreshing Genshin cache
  • Loading branch information
HoraceHuang-ui authored Feb 3, 2024
2 parents 68ed724 + 17e0494 commit e53afa3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/pages/GenshinPage/Components/GenshinInfoCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit e53afa3

Please sign in to comment.