From 46a94b789854d1f86a9e22bcd5ce0e1e78278d87 Mon Sep 17 00:00:00 2001 From: legonzaur Date: Fri, 26 May 2023 16:03:01 +0200 Subject: [PATCH] Fix infinite loading for weapon chart --- src/components/WeaponChart.vue | 4 +++- src/stores/kill.ts | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/WeaponChart.vue b/src/components/WeaponChart.vue index c5fd856..c20d09a 100644 --- a/src/components/WeaponChart.vue +++ b/src/components/WeaponChart.vue @@ -39,7 +39,9 @@ export default defineComponent({ computed: { progress () { const { weapon: _, ...withoutWeapon } = this.filters || {} - return this.store.getWeaponList(withoutWeapon)?.value.progress + const data = this.store.getWeaponList(withoutWeapon)?.value + if (!data) return this.store.fetchWeapons(withoutWeapon).value.progress + return data.progress }, colors () { // eslint-disable-next-line no-unused-expressions diff --git a/src/stores/kill.ts b/src/stores/kill.ts index 96b082e..0def9fc 100644 --- a/src/stores/kill.ts +++ b/src/stores/kill.ts @@ -58,6 +58,8 @@ function fetchWithLoading (url: string, progress: (percentage: number) => void) reader.read().then(({ done, value }) => { if (done) { controller.close() + console.log('ended') + progress(1) return } if (value) { @@ -181,6 +183,7 @@ export const useKillStore = defineStore('kill', { filter = removeNullEntries(filter) let entry = this.weapons.find((e) => objectEqual(unref(e).filter, filter)) if (!entry) { + console.log(filter) entry = shallowRef({ filter, data: {} }) this.weapons.push(entry) }