mirror of
https://github.com/VueTorrent/VueTorrent.git
synced 2025-02-27 04:40:40 +03:00
perf: reset selected torrents when changing filters (#712)
This commit is contained in:
parent
2c3afa5799
commit
b1b32127e8
1 changed files with 25 additions and 6 deletions
|
@ -85,12 +85,14 @@ import { mapGetters, mapState } from 'vuex'
|
||||||
export default {
|
export default {
|
||||||
name: 'FilterSelect',
|
name: 'FilterSelect',
|
||||||
props: ['showTrackerFilter'],
|
props: ['showTrackerFilter'],
|
||||||
data: () => ({
|
data() {
|
||||||
selectedState: null,
|
return {
|
||||||
selectedCategory: null,
|
selectedState: null,
|
||||||
selectedTag: null,
|
selectedCategory: null,
|
||||||
selectedTracker: null
|
selectedTag: null,
|
||||||
}),
|
selectedTracker: null
|
||||||
|
}
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['getCategories', 'getAvailableTags', 'getTrackers']),
|
...mapGetters(['getCategories', 'getAvailableTags', 'getTrackers']),
|
||||||
...mapState(['sort_options']),
|
...mapState(['sort_options']),
|
||||||
|
@ -155,6 +157,20 @@ export default {
|
||||||
mounted() {
|
mounted() {
|
||||||
this.loadFilter()
|
this.loadFilter()
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
selectedState() {
|
||||||
|
this.resetSelectedTorrents()
|
||||||
|
},
|
||||||
|
selectedCategory() {
|
||||||
|
this.resetSelectedTorrents()
|
||||||
|
},
|
||||||
|
selectedTag() {
|
||||||
|
this.resetSelectedTorrents()
|
||||||
|
},
|
||||||
|
selectedTracker() {
|
||||||
|
this.resetSelectedTorrents()
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
commitFilter() {
|
commitFilter() {
|
||||||
this.$store.commit('UPDATE_SORT_OPTIONS', {
|
this.$store.commit('UPDATE_SORT_OPTIONS', {
|
||||||
|
@ -185,6 +201,9 @@ export default {
|
||||||
setTracker(value) {
|
setTracker(value) {
|
||||||
this.selectedTracker = value
|
this.selectedTracker = value
|
||||||
this.commitFilter()
|
this.commitFilter()
|
||||||
|
},
|
||||||
|
resetSelectedTorrents() {
|
||||||
|
this.$store.commit('RESET_SELECTED')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue