mirror of
https://github.com/FreeTubeApp/FreeTube
synced 2024-11-22 01:45:40 +01:00
! Fix search tab showing "0 results" before search done
This commit is contained in:
parent
cdc64d078d
commit
03f887ecf1
@ -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)
|
||||
|
@ -81,7 +81,7 @@
|
||||
/>
|
||||
</div>
|
||||
<ft-loader
|
||||
v-if="isElementListLoading"
|
||||
v-if="isCurrentTabLoading"
|
||||
/>
|
||||
<div
|
||||
v-if="currentTab !== 'about' && !isElementListLoading"
|
||||
@ -201,7 +201,7 @@
|
||||
:use-channels-hidden-preference="false"
|
||||
/>
|
||||
<ft-flex-box
|
||||
v-if="currentTab === 'search' && searchResults.length === 0"
|
||||
v-if="currentTab === 'search' && !isSearchTabLoading && searchResults.length === 0"
|
||||
>
|
||||
<p class="message">
|
||||
{{ $t("Channel.Your search results have returned 0 results") }}
|
||||
|
Loading…
Reference in New Issue
Block a user