From 67b1551b36c94849d46c0a0dd5dadfda181df589 Mon Sep 17 00:00:00 2001 From: WDaan Date: Tue, 15 Nov 2022 13:56:15 +0100 Subject: [PATCH] perf: persist searchfilter + page #462 --- src/store/index.js | 6 +++++- src/views/Dashboard.vue | 22 ++++++++++++++++++---- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index b8d27989..4452b5de 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -109,7 +109,11 @@ export default new Vuex.Store({ filteredTorrentsCount: 0, latestSelectedTorrent: null, selectMode: false, - searchPlugins: [] + searchPlugins: [], + dashboard: { + currentPage: 1, + searchFilter: '' + } }, actions: { ...actions diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue index c4197724..de7d23d1 100644 --- a/src/views/Dashboard.vue +++ b/src/views/Dashboard.vue @@ -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')