fix: move scroll event behind condition

This commit is contained in:
Christoph Kluge 2024-03-28 15:57:24 +01:00
parent 0dee5073c6
commit 43ebb01b63

View File

@ -148,24 +148,23 @@
}); });
} }
window.addEventListener('scroll', () => { if (!usePaging) {
let { let scrollMultiplier = 1
scrollTop, window.addEventListener('scroll', () => {
scrollHeight, let {
clientHeight scrollTop,
} = document.documentElement; scrollHeight,
if (scrollTop + clientHeight >= scrollHeight && !usePaging && $jobsStore.data != null && $jobsStore.data.jobs.hasNextPage) { clientHeight
fetchMore() } = document.documentElement;
}
});
let scrollMultiplier = 1 if (scrollTop + clientHeight >= scrollHeight && $jobsStore.data != null && $jobsStore.data.jobs.hasNextPage) {
function fetchMore() { let pendingPaging = { ...paging }
let pendingPaging = { ...paging } scrollMultiplier += 1
scrollMultiplier += 1 pendingPaging.itemsPerPage = itemsPerPage * scrollMultiplier
pendingPaging.itemsPerPage = itemsPerPage * scrollMultiplier paging = pendingPaging
paging = pendingPaging };
} });
};
let plotWidth = null; let plotWidth = null;
let tableWidth = null; let tableWidth = null;