commit: fb8b625d9a0ec6cb08001c8476b971f79e59d2f9
parent: 302c46741d89d58b452dfbe7c5e4a760a50adab9
Author: lambda <pleromagit@rogerbraun.net>
Date: Thu, 2 Nov 2017 14:59:31 +0000
Merge branch 'fix/stop-inappropriate-scroll-auto-fetch' into 'develop'
Stop inappropriate auto fetching on scroll
See merge request pleroma/pleroma-fe!123
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js
@@ -33,7 +33,7 @@ const Timeline = {
const credentials = store.state.users.currentUser.credentials
const showImmediately = this.timeline.visibleStatuses.length === 0
- window.onscroll = this.scrollLoad
+ window.addEventListener('scroll', this.scrollLoad)
timelineFetcher.fetchAndUpdate({
store,
@@ -50,6 +50,9 @@ const Timeline = {
this.fetchFollowers()
}
},
+ destroyed () {
+ window.removeEventListener('scroll', this.scrollLoad)
+ },
methods: {
showNewStatuses () {
this.$store.commit('showNewStatuses', { timeline: this.timelineName })
@@ -80,7 +83,10 @@ const Timeline = {
},
scrollLoad (e) {
let height = Math.max(document.body.offsetHeight, document.body.scrollHeight)
- if (this.timeline.loading === false && this.$store.state.config.autoLoad && (window.innerHeight + window.pageYOffset) >= (height - 750)) {
+ if (this.timeline.loading === false &&
+ this.$store.state.config.autoLoad &&
+ this.$el.offsetHeight > 0 &&
+ (window.innerHeight + window.pageYOffset) >= (height - 750)) {
this.fetchOlderStatuses()
}
}