diff --git a/cateditor/src/pagination.js b/cateditor/src/pagination.js index 89f6c8d..933563f 100644 --- a/cateditor/src/pagination.js +++ b/cateditor/src/pagination.js @@ -9,13 +9,15 @@ export function paginateModels(models) { let currentSize = 0 let currentPage = [] for (let model of models) { - currentSize += model.size - if (currentSize > 3) { - pages.push(currentPage) - currentPage = [model] - currentSize = model.size - } else { - currentPage.push(model) + if (model.size > 0) { // skip empty models + currentSize += model.size + if (currentSize > 3) { + pages.push(currentPage) + currentPage = [model] + currentSize = model.size + } else { + currentPage.push(model) + } } } if (currentPage.length > 0) {