From 21b3a1e978e0eac8fb1d9db7710c00a3777867a0 Mon Sep 17 00:00:00 2001 From: zurdi Date: Tue, 1 Aug 2023 02:03:14 +0200 Subject: [PATCH] list scroll fixed --- frontend/src/views/Gallery.vue | 48 ++++++++++++---------------------- 1 file changed, 17 insertions(+), 31 deletions(-) diff --git a/frontend/src/views/Gallery.vue b/frontend/src/views/Gallery.vue index cfe021454..2fc938c35 100644 --- a/frontend/src/views/Gallery.vue +++ b/frontend/src/views/Gallery.vue @@ -84,18 +84,6 @@ async function fetchMoreSearch() { }); } -function onFilterChange() { - searchCursor.value = ""; - searchRoms.value = []; - - if (galleryFilter.value === "") { - filteredRoms.value = roms.value; - return; - } - - fetchMoreSearch(); -} - async function fetchMoreRoms(platform) { if (cursor.value === null || gettingRoms.value) return; @@ -114,15 +102,16 @@ async function fetchMoreRoms(platform) { }); } -function onListScroll({ target }) { - if (cursor.value === null && searchCursor.value === null) return; +function onFilterChange() { + searchCursor.value = ""; + searchRoms.value = []; - // If we are at the bottom of the page, fetch more roms - if (target.scrollTop + target.offsetHeight >= target.scrollHeight) { - galleryFilter.value - ? fetchMoreSearch() - : fetchMoreRoms(route.params.platform); + if (galleryFilter.value === "") { + filteredRoms.value = roms.value; + return; } + + fetchMoreSearch(); } function onGridScroll() { @@ -207,18 +196,15 @@ onBeforeRouteUpdate(async (to, _) => { :thickness="1" /> - - - - + + + + +