mirror of
https://github.com/h3poteto/whalebird-desktop
synced 2025-02-07 23:38:48 +01:00
Fix scroll position when lazyFetchTimeline at bottom of timeline
This commit is contained in:
parent
f47313041e
commit
2307438745
@ -175,6 +175,17 @@ export default {
|
||||
) {
|
||||
this.$store
|
||||
.dispatch('TimelineSpace/Contents/DirectMessages/lazyFetchTimeline', this.timeline[this.timeline.length - 1])
|
||||
.then(statuses => {
|
||||
if (statuses === null) {
|
||||
return
|
||||
}
|
||||
if (statuses.length > 0) {
|
||||
this.$store.commit('TimelineSpace/Contents/DirectMessages/changeScrolling', true)
|
||||
setTimeout(() => {
|
||||
this.$store.commit('TimelineSpace/Contents/DirectMessages/changeScrolling', false)
|
||||
}, 500)
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
message: this.$t('message.timeline_fetch_error'),
|
||||
|
@ -178,10 +178,28 @@ export default {
|
||||
event.target.clientHeight + event.target.scrollTop >= document.getElementById('scroller').scrollHeight - 10 &&
|
||||
!this.lazyloading
|
||||
) {
|
||||
this.$store.dispatch('TimelineSpace/Contents/Hashtag/Tag/lazyFetchTimeline', {
|
||||
tag: this.tag,
|
||||
status: this.timeline[this.timeline.length - 1]
|
||||
})
|
||||
this.$store
|
||||
.dispatch('TimelineSpace/Contents/Hashtag/Tag/lazyFetchTimeline', {
|
||||
tag: this.tag,
|
||||
status: this.timeline[this.timeline.length - 1]
|
||||
})
|
||||
.then(statuses => {
|
||||
if (statuses === null) {
|
||||
return
|
||||
}
|
||||
if (statuses.length > 0) {
|
||||
this.$store.commit('TimelineSpace/Contents/Hashtag/Tag/changeScrolling', true)
|
||||
setTimeout(() => {
|
||||
this.$store.commit('TimelineSpace/Contents/Hashtag/Tag/changeScrolling', false)
|
||||
}, 500)
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
message: this.$t('message.timeline_fetch_error'),
|
||||
type: 'error'
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
if (event.target.scrollTop > 10 && this.heading) {
|
||||
|
@ -172,12 +172,25 @@ export default {
|
||||
event.target.clientHeight + event.target.scrollTop >= document.getElementById('scroller').scrollHeight - 10 &&
|
||||
!this.lazyloading
|
||||
) {
|
||||
this.$store.dispatch('TimelineSpace/Contents/Home/lazyFetchTimeline', this.timeline[this.timeline.length - 1]).catch(() => {
|
||||
this.$message({
|
||||
message: this.$t('message.timeline_fetch_error'),
|
||||
type: 'error'
|
||||
this.$store
|
||||
.dispatch('TimelineSpace/Contents/Home/lazyFetchTimeline', this.timeline[this.timeline.length - 1])
|
||||
.then(statuses => {
|
||||
if (statuses === null) {
|
||||
return
|
||||
}
|
||||
if (statuses.length > 0) {
|
||||
this.$store.commit('TimelineSpace/Contents/Home/changeScrolling', true)
|
||||
setTimeout(() => {
|
||||
this.$store.commit('TimelineSpace/Contents/Home/changeScrolling', false)
|
||||
}, 500)
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
message: this.$t('message.timeline_fetch_error'),
|
||||
type: 'error'
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
if (event.target.scrollTop > 10 && this.heading) {
|
||||
|
@ -179,10 +179,28 @@ export default {
|
||||
event.target.clientHeight + event.target.scrollTop >= document.getElementById('scroller').scrollHeight - 10 &&
|
||||
!this.lazyloading
|
||||
) {
|
||||
this.$store.dispatch('TimelineSpace/Contents/Lists/Show/lazyFetchTimeline', {
|
||||
list_id: this.list_id,
|
||||
status: this.timeline[this.timeline.length - 1]
|
||||
})
|
||||
this.$store
|
||||
.dispatch('TimelineSpace/Contents/Lists/Show/lazyFetchTimeline', {
|
||||
list_id: this.list_id,
|
||||
status: this.timeline[this.timeline.length - 1]
|
||||
})
|
||||
.then(statuses => {
|
||||
if (statuses === null) {
|
||||
return
|
||||
}
|
||||
if (statuses.length > 0) {
|
||||
this.$store.commit('TimelineSpace/Contents/Lists/Show/changeScrolling', true)
|
||||
setTimeout(() => {
|
||||
this.$store.commit('TimelineSpace/Contents/Lists/Show/changeScrolling', false)
|
||||
}, 500)
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
message: this.$t('message.timeline_fetch_error'),
|
||||
type: 'error'
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
if (event.target.scrollTop > 10 && this.heading) {
|
||||
|
@ -178,12 +178,25 @@ export default {
|
||||
event.target.clientHeight + event.target.scrollTop >= document.getElementById('scroller').scrollHeight - 10 &&
|
||||
!this.lazyloading
|
||||
) {
|
||||
this.$store.dispatch('TimelineSpace/Contents/Local/lazyFetchTimeline', this.timeline[this.timeline.length - 1]).catch(() => {
|
||||
this.$message({
|
||||
message: this.$t('message.timeline_fetch_error'),
|
||||
type: 'error'
|
||||
this.$store
|
||||
.dispatch('TimelineSpace/Contents/Local/lazyFetchTimeline', this.timeline[this.timeline.length - 1])
|
||||
.then(statuses => {
|
||||
if (statuses === null) {
|
||||
return
|
||||
}
|
||||
if (statuses.length > 0) {
|
||||
this.$store.commit('TimelineSpace/Contents/Local/changeScrolling', true)
|
||||
setTimeout(() => {
|
||||
this.$store.commit('TimelineSpace/Contents/Local/changeScrolling', false)
|
||||
}, 500)
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
message: this.$t('message.timeline_fetch_error'),
|
||||
type: 'error'
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
if (event.target.scrollTop > 10 && this.heading) {
|
||||
this.$store.commit('TimelineSpace/Contents/Local/changeHeading', false)
|
||||
|
@ -151,12 +151,25 @@ export default {
|
||||
event.target.clientHeight + event.target.scrollTop >= document.getElementById('scroller').scrollHeight - 10 &&
|
||||
!this.lazyloading
|
||||
) {
|
||||
this.$store.dispatch('TimelineSpace/Contents/Mentions/lazyFetchMentions', this.mentions[this.mentions.length - 1]).catch(() => {
|
||||
this.$message({
|
||||
message: this.$t('message.timeline_fetch_error'),
|
||||
type: 'error'
|
||||
this.$store
|
||||
.dispatch('TimelineSpace/Contents/Mentions/lazyFetchMentions', this.mentions[this.mentions.length - 1])
|
||||
.then(statuses => {
|
||||
if (statuses === null) {
|
||||
return
|
||||
}
|
||||
if (statuses.length > 0) {
|
||||
this.$store.commit('TimelineSpace/Contents/Mentions/changeScrolling', true)
|
||||
setTimeout(() => {
|
||||
this.$store.commit('TimelineSpace/Contents/Mentions/changeScrolling', false)
|
||||
}, 500)
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
message: this.$t('message.timeline_fetch_error'),
|
||||
type: 'error'
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
if (event.target.scrollTop > 10 && this.heading) {
|
||||
|
@ -163,6 +163,17 @@ export default {
|
||||
'TimelineSpace/Contents/Notifications/lazyFetchNotifications',
|
||||
this.handledNotifications[this.handledNotifications.length - 1]
|
||||
)
|
||||
.then(statuses => {
|
||||
if (statuses === null) {
|
||||
return
|
||||
}
|
||||
if (statuses.length > 0) {
|
||||
this.$store.commit('TimelineSpace/Contents/Notifications/changeScrolling', true)
|
||||
setTimeout(() => {
|
||||
this.$store.commit('TimelineSpace/Contents/Notifications/changeScrolling', false)
|
||||
}, 500)
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
message: this.$t('message.notification_fetch_error'),
|
||||
|
@ -180,12 +180,25 @@ export default {
|
||||
event.target.clientHeight + event.target.scrollTop >= document.getElementById('scroller').scrollHeight - 10 &&
|
||||
!this.lazyloading
|
||||
) {
|
||||
this.$store.dispatch('TimelineSpace/Contents/Public/lazyFetchTimeline', this.timeline[this.timeline.length - 1]).catch(() => {
|
||||
this.$message({
|
||||
message: this.$t('message.timeline_fetch_error'),
|
||||
type: 'error'
|
||||
this.$store
|
||||
.dispatch('TimelineSpace/Contents/Public/lazyFetchTimeline', this.timeline[this.timeline.length - 1])
|
||||
.then(statuses => {
|
||||
if (statuses === null) {
|
||||
return
|
||||
}
|
||||
if (statuses.length > 0) {
|
||||
this.$store.commit('TimelineSpace/Contents/Public/changeScrolling', true)
|
||||
setTimeout(() => {
|
||||
this.$store.commit('TimelineSpace/Contents/Public/changeScrolling', false)
|
||||
}, 500)
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
message: this.$t('message.timeline_fetch_error'),
|
||||
type: 'error'
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
if (event.target.scrollTop > 10 && this.heading) {
|
||||
|
@ -131,7 +131,7 @@ const actions: ActionTree<TagState, RootState> = {
|
||||
resolve(null)
|
||||
})
|
||||
},
|
||||
lazyFetchTimeline: async ({ state, commit, rootState }, loadPosition: LoadPositionWithTag) => {
|
||||
lazyFetchTimeline: async ({ state, commit, rootState }, loadPosition: LoadPositionWithTag): Promise<Array<Entity.Status> | null> => {
|
||||
if (state.lazyLoading) {
|
||||
return Promise.resolve(null)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user