fix: scrolling pagination errors

This commit is contained in:
ThaUnknown 2023-07-07 00:19:14 +02:00
parent 2f9a22f41a
commit f7c4c7ec6a
2 changed files with 6 additions and 5 deletions

View file

@ -1,6 +1,6 @@
{
"name": "Miru",
"version": "4.1.4",
"version": "4.1.5",
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
"description": "Stream anime torrents, real-time with no waiting for downloads.",
"main": "build/main.js",

View file

@ -14,7 +14,7 @@
import smoothScroll from '@/modules/scroll.js'
import { debounce } from '@/modules/util.js'
let page = 1
let page = 0
items.value = []
hasNextPage.value = true
@ -22,12 +22,12 @@
function loadSearchData () {
const load = $search.load || Sections.createFallbackLoad()
const nextData = load(page, undefined, searchCleanup($search))
const nextData = load(++page, undefined, searchCleanup($search))
$items = [...$items, ...nextData]
return nextData[nextData.length - 1].data
}
const update = debounce(() => {
page = 1
page = 0
items.value = []
key = {}
loadSearchData()
@ -37,14 +37,15 @@
async function loadTillFull (element) {
while (hasNextPage.value && element.scrollHeight <= element.clientHeight) {
canScroll = false
await loadSearchData()
}
canScroll = true
}
async function infiniteScroll () {
if (canScroll && $hasNextPage && this.scrollTop + this.clientHeight > this.scrollHeight - 800) {
canScroll = false
page++
await loadSearchData()
canScroll = true
}