split loading between older and newer, add newer loading indicator
This commit is contained in:
parent
954bbedb2d
commit
121038dc96
3 changed files with 26 additions and 6 deletions
|
|
@ -238,7 +238,7 @@ const Timeline = {
|
||||||
const bodyBRect = document.body.getBoundingClientRect()
|
const bodyBRect = document.body.getBoundingClientRect()
|
||||||
const height = Math.max(bodyBRect.height, -bodyBRect.y)
|
const height = Math.max(bodyBRect.height, -bodyBRect.y)
|
||||||
if (
|
if (
|
||||||
!this.timeline.fetcher.loading.value &&
|
!this.timeline.fetcher.loadingOlder.value &&
|
||||||
this.$el.offsetHeight > 0 &&
|
this.$el.offsetHeight > 0 &&
|
||||||
window.innerHeight + window.pageYOffset >= height - 750
|
window.innerHeight + window.pageYOffset >= height - 750
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,16 @@
|
||||||
v-if="!embedded"
|
v-if="!embedded"
|
||||||
:timeline-name="timelineRef.name"
|
:timeline-name="timelineRef.name"
|
||||||
/>
|
/>
|
||||||
|
<div
|
||||||
|
v-if="timeline.fetcher.loadingNewer"
|
||||||
|
class="loadingIndicator"
|
||||||
|
>
|
||||||
|
<FAIcon
|
||||||
|
fixed-width
|
||||||
|
icon="circle-notch"
|
||||||
|
spin
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<ScrollTopButton />
|
<ScrollTopButton />
|
||||||
<template v-if="mobileLayout">
|
<template v-if="mobileLayout">
|
||||||
<div
|
<div
|
||||||
|
|
@ -102,7 +112,7 @@
|
||||||
{{ $t('timeline.no_more_statuses') }}
|
{{ $t('timeline.no_more_statuses') }}
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
v-else-if="!timeline.fetcher.loading"
|
v-else-if="!timeline.fetcher.loadingOlder"
|
||||||
class="button-unstyled -link"
|
class="button-unstyled -link"
|
||||||
@click.prevent="fetchOlderStatuses()"
|
@click.prevent="fetchOlderStatuses()"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,17 @@ const REPLY_VISIBILITY_TIMELINES = new Set([
|
||||||
])
|
])
|
||||||
|
|
||||||
const timelineFetcher = (timeline, argument, credentials) => {
|
const timelineFetcher = (timeline, argument, credentials) => {
|
||||||
const loading = ref(false)
|
const loadingNewer = ref(false)
|
||||||
|
const loadingOlder = ref(false)
|
||||||
const bottomedOut = ref(false)
|
const bottomedOut = ref(false)
|
||||||
const interval = ref(null)
|
const interval = ref(null)
|
||||||
|
|
||||||
const fetchAndUpdate = ({ older = false, showImmediately = false } = {}) => {
|
const fetchAndUpdate = ({ older = false, showImmediately = false } = {}) => {
|
||||||
loading.value = true
|
if (older) {
|
||||||
|
loadingOlder.value = true
|
||||||
|
} else {
|
||||||
|
loadingNewer.value = true
|
||||||
|
}
|
||||||
|
|
||||||
const { hideMutedPosts, replyVisibility } =
|
const { hideMutedPosts, replyVisibility } =
|
||||||
useMergedConfigStore().mergedConfig
|
useMergedConfigStore().mergedConfig
|
||||||
|
|
@ -85,7 +90,11 @@ const timelineFetcher = (timeline, argument, credentials) => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
loading.value = false
|
if (older) {
|
||||||
|
loadingOlder.value = false
|
||||||
|
} else {
|
||||||
|
loadingNewer.value = false
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -108,7 +117,8 @@ const timelineFetcher = (timeline, argument, credentials) => {
|
||||||
startFetching,
|
startFetching,
|
||||||
stopFetching,
|
stopFetching,
|
||||||
fetchOlder: () => fetchAndUpdate({ showImmediately: true, older: true }),
|
fetchOlder: () => fetchAndUpdate({ showImmediately: true, older: true }),
|
||||||
loading,
|
loadingOlder,
|
||||||
|
loadingNewer,
|
||||||
bottomedOut,
|
bottomedOut,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue