! Fix unable to view another playlist when already in playlist view (#1211)

This commit is contained in:
PikachuEXE 2021-04-28 02:30:29 +08:00 committed by GitHub
parent 2752006179
commit e4e3090153
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 27 deletions

View File

@ -7,7 +7,7 @@ import FtListVideo from '../../components/ft-list-video/ft-list-video.vue'
import FtFlexBox from '../../components/ft-flex-box/ft-flex-box.vue' import FtFlexBox from '../../components/ft-flex-box/ft-flex-box.vue'
export default Vue.extend({ export default Vue.extend({
name: 'Search', name: 'Playlist',
components: { components: {
'ft-loader': FtLoader, 'ft-loader': FtLoader,
'ft-card': FtCard, 'ft-card': FtCard,
@ -40,37 +40,25 @@ export default Vue.extend({
watch: { watch: {
$route () { $route () {
// react to route changes... // react to route changes...
const payload = { this.getPlaylist()
query: this.$route.params.query,
options: {},
nextPage: false
}
if (typeof (this.sessionSearchHistory[this.query]) !== 'undefined' && this.query !== this.$route.params.query) {
this.isLoading = true
this.shownResults = []
// Replacing the data right away causes a strange error where the data
// Shown is mixed from 2 different search results. So we'll wait a moment
// Before showing the results.
setTimeout(this.replaceShownResults, 100, this.sessionSearchHistory[this.query])
} else {
this.performSearch(payload)
}
} }
}, },
mounted: function () { mounted: function () {
this.playlistId = this.$route.params.id this.getPlaylist()
switch (this.backendPreference) {
case 'local':
this.getPlaylistLocal()
break
case 'invidious':
this.getPlaylistInvidious()
break
}
}, },
methods: { methods: {
getPlaylist: function () {
this.playlistId = this.$route.params.id
switch (this.backendPreference) {
case 'local':
this.getPlaylistLocal()
break
case 'invidious':
this.getPlaylistInvidious()
break
}
},
getPlaylistLocal: function () { getPlaylistLocal: function () {
this.isLoading = true this.isLoading = true