From 0c8dbdab440c177fcd717a02720d0100b9332ff0 Mon Sep 17 00:00:00 2001 From: Hakadao Date: Sat, 23 Sep 2023 23:29:06 +0800 Subject: [PATCH] fix: cannot change tab when moments count is 0 #32 fix: repeat fetching the live list when there is no more content #34 --- src/components/Topbar/TopbarMomentsPop.vue | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/Topbar/TopbarMomentsPop.vue b/src/components/Topbar/TopbarMomentsPop.vue index 23669e20..64a05a26 100644 --- a/src/components/Topbar/TopbarMomentsPop.vue +++ b/src/components/Topbar/TopbarMomentsPop.vue @@ -80,10 +80,11 @@ onMounted(() => { function onClickTab(tabId: number) { // Prevent changing tab when loading, cuz it will cause a bug - if (isLoading.value) + if (isLoading.value || tabId === selectedTab.value) return selectedTab.value = tabId + moments.length = 0 momentTabs.forEach((tab) => { tab.isSelected = tab.id === tabId }) @@ -152,7 +153,6 @@ function getHistoryMoments(typeList: number[]) { } function getLiveMoments(page: number) { - moments.length = 0 isLoading.value = true browser.runtime .sendMessage({ @@ -166,6 +166,8 @@ function getLiveMoments(page: number) { if (moments.length !== 0 && res.data.list.length < 10) { isLoading.value = false noMoreContent.value = true + console.log('no more content') + return } @@ -298,9 +300,9 @@ function pushItemIntoMoments(item: any) {