From 8ff2694cadd3ab3d51f96fc2ea3bbfde29475660 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 12 Jul 2020 00:12:30 +0900 Subject: [PATCH] =?UTF-8?q?feat(client):=20=E3=83=9F=E3=83=A5=E3=83=BC?= =?UTF-8?q?=E3=83=86=E3=83=BC=E3=82=B7=E3=83=A7=E3=83=B3=E7=9B=A3=E8=A6=96?= =?UTF-8?q?=E3=82=92=E3=82=84=E3=82=81=E3=81=A6=E3=83=9A=E3=83=BC=E3=82=B8?= =?UTF-8?q?=E3=83=AA=E3=83=AD=E3=83=BC=E3=83=89=E3=81=99=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/pages/preferences/index.vue | 6 +++++- src/client/scripts/paging.ts | 9 --------- src/client/store.ts | 4 ---- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/client/pages/preferences/index.vue b/src/client/pages/preferences/index.vue index ffc8858764..2b34513865 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 8efff7aa41..832f0720e0 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 38994f90c7..d163e889c3 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; - }, } },