Skip to content

Commit

Permalink
fix: move scroll event behind condition
Browse files Browse the repository at this point in the history
  • Loading branch information
spacehamster87 committed Mar 28, 2024
1 parent 0dee507 commit 43ebb01
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions web/frontend/src/joblist/JobList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -148,24 +148,23 @@
});
}
window.addEventListener('scroll', () => {
let {
scrollTop,
scrollHeight,
clientHeight
} = document.documentElement;
if (scrollTop + clientHeight >= scrollHeight && !usePaging && $jobsStore.data != null && $jobsStore.data.jobs.hasNextPage) {
fetchMore()
}
});
if (!usePaging) {
let scrollMultiplier = 1
window.addEventListener('scroll', () => {
let {
scrollTop,
scrollHeight,
clientHeight
} = document.documentElement;
let scrollMultiplier = 1
function fetchMore() {
let pendingPaging = { ...paging }
scrollMultiplier += 1
pendingPaging.itemsPerPage = itemsPerPage * scrollMultiplier
paging = pendingPaging
}
if (scrollTop + clientHeight >= scrollHeight && $jobsStore.data != null && $jobsStore.data.jobs.hasNextPage) {
let pendingPaging = { ...paging }
scrollMultiplier += 1
pendingPaging.itemsPerPage = itemsPerPage * scrollMultiplier
paging = pendingPaging
};
});
};
let plotWidth = null;
let tableWidth = null;
Expand Down

0 comments on commit 43ebb01

Please sign in to comment.