mirror of https://github.com/FreeTubeApp/FreeTube
Fix duplicate content updates run on channel switch (#3764)
* Revert "Bump prettier from 2.8.8 to 3.0.0 (#3758)"
This reverts commit f77ae6da16
.
* ! Fix duplicate content updates run on channel switch
This commit is contained in:
parent
0d10face50
commit
930184d29d
|
@ -104,7 +104,9 @@ export default defineComponent({
|
||||||
playlistSelectValues: [
|
playlistSelectValues: [
|
||||||
'newest',
|
'newest',
|
||||||
'last'
|
'last'
|
||||||
]
|
],
|
||||||
|
|
||||||
|
autoRefreshOnSortByChangeEnabled: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -257,6 +259,9 @@ export default defineComponent({
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disable auto refresh on sort value change during state reset
|
||||||
|
this.autoRefreshOnSortByChangeEnabled = false
|
||||||
|
|
||||||
this.id = this.$route.params.id
|
this.id = this.$route.params.id
|
||||||
this.searchPage = 2
|
this.searchPage = 2
|
||||||
this.relatedChannels = []
|
this.relatedChannels = []
|
||||||
|
@ -296,14 +301,20 @@ export default defineComponent({
|
||||||
this.showShareMenu = true
|
this.showShareMenu = true
|
||||||
this.errorMessage = ''
|
this.errorMessage = ''
|
||||||
|
|
||||||
|
// Re-enable auto refresh on sort value change AFTER update done
|
||||||
if (!process.env.IS_ELECTRON || this.backendPreference === 'invidious') {
|
if (!process.env.IS_ELECTRON || this.backendPreference === 'invidious') {
|
||||||
this.getChannelInfoInvidious()
|
this.getChannelInfoInvidious()
|
||||||
|
this.autoRefreshOnSortByChangeEnabled = true
|
||||||
} else {
|
} else {
|
||||||
this.getChannelLocal()
|
this.getChannelLocal().finally(() => {
|
||||||
|
this.autoRefreshOnSortByChangeEnabled = true
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
videoSortBy () {
|
videoSortBy () {
|
||||||
|
if (!this.autoRefreshOnSortByChangeEnabled) { return }
|
||||||
|
|
||||||
this.isElementListLoading = true
|
this.isElementListLoading = true
|
||||||
this.latestVideos = []
|
this.latestVideos = []
|
||||||
switch (this.apiUsed) {
|
switch (this.apiUsed) {
|
||||||
|
@ -319,6 +330,8 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
shortSortBy() {
|
shortSortBy() {
|
||||||
|
if (!this.autoRefreshOnSortByChangeEnabled) { return }
|
||||||
|
|
||||||
this.isElementListLoading = true
|
this.isElementListLoading = true
|
||||||
this.latestShorts = []
|
this.latestShorts = []
|
||||||
switch (this.apiUsed) {
|
switch (this.apiUsed) {
|
||||||
|
@ -334,6 +347,8 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
liveSortBy () {
|
liveSortBy () {
|
||||||
|
if (!this.autoRefreshOnSortByChangeEnabled) { return }
|
||||||
|
|
||||||
this.isElementListLoading = true
|
this.isElementListLoading = true
|
||||||
this.latestLive = []
|
this.latestLive = []
|
||||||
switch (this.apiUsed) {
|
switch (this.apiUsed) {
|
||||||
|
@ -349,6 +364,8 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
playlistSortBy () {
|
playlistSortBy () {
|
||||||
|
if (!this.autoRefreshOnSortByChangeEnabled) { return }
|
||||||
|
|
||||||
this.isElementListLoading = true
|
this.isElementListLoading = true
|
||||||
this.latestPlaylists = []
|
this.latestPlaylists = []
|
||||||
this.playlistContinuationData = null
|
this.playlistContinuationData = null
|
||||||
|
@ -382,10 +399,14 @@ export default defineComponent({
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable auto refresh on sort value change AFTER initial update done
|
||||||
if (!process.env.IS_ELECTRON || this.backendPreference === 'invidious') {
|
if (!process.env.IS_ELECTRON || this.backendPreference === 'invidious') {
|
||||||
this.getChannelInfoInvidious()
|
this.getChannelInfoInvidious()
|
||||||
|
this.autoRefreshOnSortByChangeEnabled = true
|
||||||
} else {
|
} else {
|
||||||
this.getChannelLocal()
|
this.getChannelLocal().finally(() => {
|
||||||
|
this.autoRefreshOnSortByChangeEnabled = true
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
Loading…
Reference in New Issue