[client] Adjust timeline prefetch parameters

This commit is contained in:
Laura Hausmann 2023-11-23 23:50:01 +01:00
parent ff55cad0fb
commit c742729796
Signed by: zotan
GPG key ID: D044E84C5BE01605

View file

@ -54,7 +54,7 @@ const props = defineProps<{
const pagingComponent = ref<InstanceType<typeof MkPagination>>();
const interval = ref<NodeJS.Timer>();
const lastFetchScrollTop = ref(document.documentElement.clientHeight / 2 * -1);
const lastFetchScrollTop = ref(document.documentElement.clientHeight * -0.5);
function scrollTop() {
if (!tlEl.value) return;
@ -66,7 +66,8 @@ function setTimer() {
interval.value = setInterval(() => {
const viewport = document.documentElement.clientHeight;
const left = document.documentElement.scrollHeight - document.documentElement.scrollTop;
if (left > viewport * 3 || document.documentElement.scrollTop - lastFetchScrollTop.value < viewport) return;
console.log(document.documentElement.scrollTop - lastFetchScrollTop.value);
if (left > Math.max(viewport * 3, 4000) || document.documentElement.scrollTop - lastFetchScrollTop.value < viewport) return;
pagingComponent.value.prefetchMore();
lastFetchScrollTop.value = document.documentElement.scrollTop;
}, 100);