fix(paginator): item count less than buffer

pull/914/head
三咲智子 2023-01-09 23:20:54 +08:00
rodzic 01a24a6015
commit 333cab0858
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 69992F2250DFD93E
1 zmienionych plików z 4 dodań i 1 usunięć

Wyświetl plik

@ -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'