Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/modules/pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ export default {
allSelected = true
}

if (opts.pageSize <= 0) {
opts.pageSize = opts.totalRows
allSelected = true
}
Comment on lines +53 to +56
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pageSize <= 0 normalization is inside if (opts.totalRows), but pageFrom/pageTo are calculated later unconditionally using opts.pageSize. If totalRows is 0 (or otherwise falsy) and pageSize is 0/negative, this leaves an invalid page range (e.g. pageFrom becomes 1 while pageTo can be 0/negative), which can leak into pagination info rendering (notably when onlyInfoPagination is enabled, the pagination container isn't auto-hidden for empty data). Consider normalizing opts.pageSize (or using a local effective page size) before the opts.totalRows check, and ensure arithmetic uses a positive page size even when totalRows is 0.

Copilot uses AI. Check for mistakes.
Comment on lines +53 to +56
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change fixes a crash/NaN behavior for pageSize <= 0, but there doesn't appear to be a regression test covering pageSize set to 0 or a negative value. Adding a Cypress test case that initializes a table with pagination: true and pageSize: 0 (and -1) and asserts pagination renders without errors and behaves like “all rows” would help prevent this from regressing.

Copilot uses AI. Check for mistakes.

this.totalPages = ~~((opts.totalRows - 1) / opts.pageSize) + 1

opts.totalPages = this.totalPages
Expand Down
Loading