Skip to content

Commit

Permalink
fix: scrolling pagination errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ThaUnknown committed Jul 6, 2023
1 parent 2f9a22f commit f7c4c7e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
9 changes: 5 additions & 4 deletions src/renderer/views/Search.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@
import smoothScroll from '@/modules/scroll.js'
import { debounce } from '@/modules/util.js'
let page = 1
let page = 0
items.value = []
hasNextPage.value = true
let key = {}
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()
Expand All @@ -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
}
Expand Down

0 comments on commit f7c4c7e

Please sign in to comment.