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:
parent
01a24a6015
commit
333cab0858
1 changed files with 4 additions and 1 deletions
|
@ -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'
|
||||
|
|
Loading…
Reference in a new issue