Conversation
- Fix off-by-one bug in \$totalItems: pagination.page is already 1-indexed,
removing the erroneous +1 and the trailing -1 from the formula
- When hasMoreContent is true, use limit*(page+1) to reliably enable PrimeNG
next-page button regardless of partial page sizes
- Extract LazyLoadEvent & { page: number } into DotContentDrivePaginateEvent
in @dotcms/dotcms-models and use it across the paginate output and handler
- Add ES2022 lib to dot-content-drive portlet tsconfig to allow Array.at()
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…-with-limited-user-frontend
- Shell spec: replace totalItems mock with pages mock, update onPaginate assertions to include page field, add $totalItems computed test suite covering hasMoreContent true/false and multi-page scenarios - Store spec: update all setPagination calls to include required page field, fix $request assertions to use contentCursor/folderCursor instead of offset, remove obsolete totalItems assertion - List view spec: update onPage emit assertions to include resolved page number, add onPage page number calculation test suite, update paginator visibility test to reflect always-on paginator Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
dario-daza
reviewed
Mar 6, 2026
KevinDavilaDotCMS
approved these changes
Mar 6, 2026
KevinDavilaDotCMS
approved these changes
Mar 6, 2026
dario-daza
reviewed
Mar 6, 2026
Member
dario-daza
left a comment
There was a problem hiding this comment.
Plus a couple of questions:
- How are you handling previous pages navigation?
- Could you add a test for a user with restricted content access?
…-with-limited-user-frontend
dario-daza
approved these changes
Mar 6, 2026
spbolton
pushed a commit
that referenced
this pull request
Mar 24, 2026
#34890) ## Summary - **Fix off-by-one in `$totalItems`**: `pagination.page` is already 1-indexed — removed the erroneous `+ 1` (and the trailing `- 1`) that inflated the total by a full page on every page - **Correct `hasMoreContent = true` formula**: changed from `items.length * currentPage` to `limit * (currentPage + 1)` so PrimeNG's next-page button is reliably enabled regardless of partial page sizes - **Extract `DotContentDrivePaginateEvent` type**: moved `LazyLoadEvent & { page: number }` into `@dotcms/dotcms-models` and used it across the `paginate` output in `DotFolderListViewComponent` and the `onPaginate` handler in the shell component - **Add ES2022 lib to portlet tsconfig**: scoped to `dot-content-drive` portlet only to enable `Array.prototype.at()` without a workspace-wide change ## Test plan - [ ] Navigate to Content Drive, verify pagination numbers are correct on each page - [ ] Verify "next page" button is enabled when `hasMoreContent = true` - [ ] Verify "next page" button is disabled on the last page (`hasMoreContent = false`) - [ ] Verify page resets to 1 when changing path, filters, or rows-per-page - [ ] Verify no TypeScript errors on `paginate` output / `onPaginate` handler 🤖 Generated with [Claude Code](https://claude.com/claude-code) This PR fixes: #34354 --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
$totalItems:pagination.pageis already 1-indexed — removed the erroneous+ 1(and the trailing- 1) that inflated the total by a full page on every pagehasMoreContent = trueformula: changed fromitems.length * currentPagetolimit * (currentPage + 1)so PrimeNG's next-page button is reliably enabled regardless of partial page sizesDotContentDrivePaginateEventtype: movedLazyLoadEvent & { page: number }into@dotcms/dotcms-modelsand used it across thepaginateoutput inDotFolderListViewComponentand theonPaginatehandler in the shell componentdot-content-driveportlet only to enableArray.prototype.at()without a workspace-wide changeTest plan
hasMoreContent = truehasMoreContent = false)paginateoutput /onPaginatehandler🤖 Generated with Claude Code
This PR fixes: #34354
This PR fixes: #34354