diff --git a/packages/repository/src/relations/relation.helpers.ts b/packages/repository/src/relations/relation.helpers.ts index 1f3f8c6d6eaa..a4c8189bd147 100644 --- a/packages/repository/src/relations/relation.helpers.ts +++ b/packages/repository/src/relations/relation.helpers.ts @@ -95,7 +95,7 @@ function splitByPageSize(items: T[], pageSize: number): T[][] { if (pageSize < 0) return [items]; if (!pageSize) throw new Error(`Invalid page size: ${pageSize}`); const pages: T[][] = []; - for (let i = 0; i < pages.length; i += pageSize) { + for (let i = 0; i < items.length; i += pageSize) { pages.push(items.slice(i, i + pageSize)); } return pages;