From 03f887ecf12b1b378d1735d6908b57d20a0b8c8a Mon Sep 17 00:00:00 2001 From: PikachuEXE Date: Wed, 16 Oct 2024 09:44:51 +0800 Subject: [PATCH] ! Fix search tab showing "0 results" before search done --- src/renderer/views/Channel/Channel.js | 15 ++++++++++++--- src/renderer/views/Channel/Channel.vue | 4 ++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/renderer/views/Channel/Channel.js b/src/renderer/views/Channel/Channel.js index f69b7a4481851..fb8d829a21320 100644 --- a/src/renderer/views/Channel/Channel.js +++ b/src/renderer/views/Channel/Channel.js @@ -64,6 +64,7 @@ export default defineComponent({ skipRouteChangeWatcherOnce: false, isLoading: true, isElementListLoading: false, + isSearchTabLoading: false, currentTab: 'videos', id: '', /** @type {import('youtubei.js').YT.Channel|null} */ @@ -296,6 +297,14 @@ export default defineComponent({ return values }, + + isCurrentTabLoading() { + if (this.currentTab === 'search') { + return this.isSearchTabLoading + } + + return this.isElementListLoading + }, }, watch: { $route() { @@ -1898,7 +1907,7 @@ export default defineComponent({ newSearch: function (query) { this.lastSearchQuery = query this.searchContinuationData = null - this.isElementListLoading = true + this.isSearchTabLoading = true this.searchPage = 1 this.searchResults = [] this.changeTab('search') @@ -1953,7 +1962,7 @@ export default defineComponent({ } this.searchContinuationData = result.has_continuation ? result : null - this.isElementListLoading = false + this.isSearchTabLoading = false } catch (err) { console.error(err) const errorMessage = this.$t('Local API Error (Click to copy)') @@ -1989,7 +1998,7 @@ export default defineComponent({ } else { this.searchResults = this.searchResults.concat(response) } - this.isElementListLoading = false + this.isSearchTabLoading = false this.searchPage++ }).catch((err) => { console.error(err) diff --git a/src/renderer/views/Channel/Channel.vue b/src/renderer/views/Channel/Channel.vue index 1d0f2b634648e..61f1b9ca1a5cd 100644 --- a/src/renderer/views/Channel/Channel.vue +++ b/src/renderer/views/Channel/Channel.vue @@ -81,7 +81,7 @@ />

{{ $t("Channel.Your search results have returned 0 results") }}