perf: persist searchfilter + page #462

This commit is contained in:
WDaan 2022-11-15 13:56:15 +01:00
parent 3b989499b8
commit 67b1551b36
2 changed files with 23 additions and 5 deletions

View file

@ -109,7 +109,11 @@ export default new Vuex.Store({
filteredTorrentsCount: 0,
latestSelectedTorrent: null,
selectMode: false,
searchPlugins: []
searchPlugins: [],
dashboard: {
currentPage: 1,
searchFilter: ''
}
},
actions: {
...actions

View file

@ -155,11 +155,8 @@ export default {
LastFinger: 0,
LastHash: ''
},
trcMoveTick: 0,
input: '',
searchFilterEnabled: false,
pageNumber: 1,
mdiTextBoxSearch,
mdiChevronLeftCircle,
mdiMagnify,
@ -169,7 +166,7 @@ export default {
}
},
computed: {
...mapState(['mainData', 'selected_torrents']),
...mapState(['mainData', 'selected_torrents', 'dashboard']),
...mapGetters(['getTorrents', 'getTorrentCountString', 'getWebuiSettings']),
torrents() {
if (!this.hasSearchFilter) return this.getTorrents()
@ -183,6 +180,22 @@ export default {
return fuse.search(this.input).map(el => el.item)
},
pageNumber: {
get() {
return this.dashboard.currentPage
},
set(val) {
this.dashboard.currentPage = val
}
},
input: {
get() {
return this.dashboard.searchFilter
},
set(val) {
this.dashboard.searchFilter = val
}
},
topPagination() {
return this.getWebuiSettings().topPagination
},
@ -240,6 +253,7 @@ export default {
created() {
this.$store.dispatch('INIT_INTERVALS')
this.$store.commit('FETCH_CATEGORIES')
if(this.input) this.searchFilterEnabled = true
},
beforeDestroy() {
this.$store.commit('REMOVE_INTERVALS')