fix: intermitten initialization on Home screen

This commit is contained in:
Phan An 2022-10-22 10:23:46 +02:00
parent e67cd48855
commit 1c2b44d712
No known key found for this signature in database
GPG key ID: A81E4477F0BB6FDC

View file

@ -36,7 +36,7 @@
<script lang="ts" setup>
import { faVolumeOff } from '@fortawesome/free-solid-svg-icons'
import { sample } from 'lodash'
import { computed, onMounted, ref } from 'vue'
import { computed, ref } from 'vue'
import { eventBus, noop } from '@/utils'
import { commonStore, overviewStore, userStore } from '@/stores'
import { useAuthorization, useInfiniteScroll, useScreen } from '@/composables'
@ -74,18 +74,14 @@ let initialized = false
eventBus.on(['SONGS_DELETED', 'SONGS_UPDATED'], () => overviewStore.refresh())
const initialize = async () => {
useScreen('Home').onScreenActivated(async () => {
if (!initialized) {
loading.value = true
await overviewStore.init()
initialized = true
loading.value = false
}
}
onMounted(async () => await initialize())
useScreen('Home').onScreenActivated(async () => await initialize())
})
</script>
<style lang="scss">