From 838d2ea981a144ea5c6337f3540dfda88648a556 Mon Sep 17 00:00:00 2001 From: Hakadao Date: Mon, 27 May 2024 01:57:29 +0800 Subject: [PATCH] fix: some videos disappear on following and subscribed series pages (#786) --- .../views/Home/components/Following.vue | 20 +++++++++++++------ .../Home/components/SubscribedSeries.vue | 20 +++++++++++++------ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/contentScripts/views/Home/components/Following.vue b/src/contentScripts/views/Home/components/Following.vue index 7bb0b032..5e8edd0b 100644 --- a/src/contentScripts/views/Home/components/Following.vue +++ b/src/contentScripts/views/Home/components/Following.vue @@ -79,8 +79,20 @@ async function initData() { } async function getData() { - for (let i = 0; i < 3; i++) - await getFollowedUsersVideos() + if (isLoading.value) + return + + emit('beforeLoading') + isLoading.value = true + + try { + for (let i = 0; i < 3; i++) + await getFollowedUsersVideos() + } + finally { + isLoading.value = false + emit('afterLoading') + } } async function getFollowedUsersVideos() { @@ -92,8 +104,6 @@ async function getFollowedUsersVideos() { return } - emit('beforeLoading') - isLoading.value = true try { let i = 0 // https://github.com/starknt/BewlyBewly/blob/fad999c2e482095dc3840bb291af53d15ff44130/src/contentScripts/views/Home/components/ForYou.vue#L208 @@ -146,8 +156,6 @@ async function getFollowedUsersVideos() { } finally { videoList.value = videoList.value.filter(video => video.item) - isLoading.value = false - emit('afterLoading') } } diff --git a/src/contentScripts/views/Home/components/SubscribedSeries.vue b/src/contentScripts/views/Home/components/SubscribedSeries.vue index d4d973ec..86f9903a 100644 --- a/src/contentScripts/views/Home/components/SubscribedSeries.vue +++ b/src/contentScripts/views/Home/components/SubscribedSeries.vue @@ -64,8 +64,20 @@ async function initData() { } async function getData() { - for (let i = 0; i < 3; i++) - await getFollowedUsersVideos() + if (isLoading.value) + return + + emit('beforeLoading') + isLoading.value = true + + try { + for (let i = 0; i < 3; i++) + await getFollowedUsersVideos() + } + finally { + isLoading.value = false + emit('afterLoading') + } } function initPageAction() { @@ -96,8 +108,6 @@ async function getFollowedUsersVideos() { return } - emit('beforeLoading') - isLoading.value = true try { let i = 0 // https://github.com/starknt/BewlyBewly/blob/fad999c2e482095dc3840bb291af53d15ff44130/src/contentScripts/views/Home/components/ForYou.vue#L208 @@ -150,8 +160,6 @@ async function getFollowedUsersVideos() { } finally { videoList.value = videoList.value.filter(video => video.item) - isLoading.value = false - emit('afterLoading') } }