1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-11-05 00:19:59 +00:00

fix(paginator): item count less than buffer

This commit is contained in:
三咲智子 2023-01-09 23:20:54 +08:00
parent 01a24a6015
commit 333cab0858
No known key found for this signature in database
GPG key ID: 69992F2250DFD93E

View file

@ -66,7 +66,10 @@ export function usePaginator<T, P, U = T>(
if (result.value?.length) {
const preprocessedItems = preprocess([...nextItems.value, ...result.value]) as any
const itemsToShowCount = preprocessedItems.length - buffer
const itemsToShowCount
= preprocessedItems.length < buffer
? preprocessedItems.length
: preprocessedItems.length - buffer
nextItems.value = preprocessedItems.slice(itemsToShowCount)
items.value.push(...preprocessedItems.slice(0, itemsToShowCount))
state.value = 'idle'