pagination: remove empty models
This commit is contained in:
@ -9,6 +9,7 @@ export function paginateModels(models) {
|
|||||||
let currentSize = 0
|
let currentSize = 0
|
||||||
let currentPage = []
|
let currentPage = []
|
||||||
for (let model of models) {
|
for (let model of models) {
|
||||||
|
if (model.size > 0) { // skip empty models
|
||||||
currentSize += model.size
|
currentSize += model.size
|
||||||
if (currentSize > 3) {
|
if (currentSize > 3) {
|
||||||
pages.push(currentPage)
|
pages.push(currentPage)
|
||||||
@ -18,6 +19,7 @@ export function paginateModels(models) {
|
|||||||
currentPage.push(model)
|
currentPage.push(model)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (currentPage.length > 0) {
|
if (currentPage.length > 0) {
|
||||||
pages.push(currentPage)
|
pages.push(currentPage)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user