diff --git a/src/client/pages/preferences/index.vue b/src/client/pages/preferences/index.vue index ffc885876..2b3451386 100644 --- a/src/client/pages/preferences/index.vue +++ b/src/client/pages/preferences/index.vue @@ -201,7 +201,7 @@ export default Vue.extend({ enableInfiniteScroll: { get() { return this.$store.state.device.enableInfiniteScroll; }, - set(value) { this.$store.commit('device/setInfiniteScrollEnabling', value); } + set(value) { this.$store.commit('device/set', { key: 'enableInfiniteScroll', value }); } }, fixedWidgetsPosition: { @@ -294,6 +294,10 @@ export default Vue.extend({ fixedWidgetsPosition() { location.reload() }, + + enableInfiniteScroll() { + location.reload() + }, }, methods: { diff --git a/src/client/scripts/paging.ts b/src/client/scripts/paging.ts index 8efff7aa4..832f0720e 100644 --- a/src/client/scripts/paging.ts +++ b/src/client/scripts/paging.ts @@ -22,7 +22,6 @@ export default (opts) => ({ && this.fetchMore() ), loadMoreElement: null as Element, - unsubscribeInfiniteScrollMutation: null as any, }; }, @@ -65,13 +64,6 @@ export default (opts) => ({ this.loadMoreElement = this.$refs.loadMore instanceof Element ? this.$refs.loadMore : this.$refs.loadMore.$el; if (this.$store.state.device.enableInfiniteScroll) this.ilObserver.observe(this.loadMoreElement); this.loadMoreElement.addEventListener('click', this.fetchMore); - - this.unsubscribeInfiniteScrollMutation = this.$store.subscribe(mutation => { - if (mutation.type !== 'device/setInfiniteScrollEnabling') return; - - if (mutation.payload) return this.ilObserver.observe(this.loadMoreElement); - return this.ilObserver.unobserve(this.loadMoreElement); - }); } }); }, @@ -79,7 +71,6 @@ export default (opts) => ({ beforeDestroy() { this.ilObserver.disconnect(); if (this.$refs.loadMore) this.loadMoreElement.removeEventListener('click', this.fetchMore); - if (this.unsubscribeInfiniteScrollMutation) this.unsubscribeInfiniteScrollMutation(); }, methods: { diff --git a/src/client/store.ts b/src/client/store.ts index 38994f90c..d163e889c 100644 --- a/src/client/store.ts +++ b/src/client/store.ts @@ -355,10 +355,6 @@ export default () => new Vuex.Store({ setUserData(state, x: { userId: string; data: any }) { state.userData[x.userId] = copy(x.data); }, - - setInfiniteScrollEnabling(state, x: boolean) { - state.enableInfiniteScroll = x; - }, } },