refactor(ui): unify DataTable pagination into a single callback#10863
Open
pfe-nazaries wants to merge 4 commits intomasterfrom
Open
refactor(ui): unify DataTable pagination into a single callback#10863pfe-nazaries wants to merge 4 commits intomasterfrom
pfe-nazaries wants to merge 4 commits intomasterfrom
Conversation
Contributor
|
✅ All necessary |
Contributor
|
✅ Conflict Markers Resolved All conflict markers have been successfully resolved in this pull request. |
12 tasks
Contributor
🔒 Container Security ScanImage: 📊 Vulnerability Summary
2 package(s) affected
|
added 3 commits
April 23, 2026 12:00
- Replace onPageChange/onPageSizeChange pair with onPaginationChange(page, pageSize) - Fix silent revert of page-size change when consumers drive state via router.push - Update consumers ScanListTable and ResourceDetailContent
- Rephrase to focus on user-facing symptom (rows-per-page selector) - Drop implementation detail; add PR link
b344575 to
5715bb7
Compare
…ied-pagination-callback # Conflicts: # ui/CHANGELOG.md # ui/app/(prowler)/attack-paths/(workflow)/query-builder/_components/scan-list-table.tsx
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.
Context
DataTablePaginationin controlled mode exposed two separate callbacks,onPageChangeandonPageSizeChange, and fired them back-to-back in the same tick when the user picked a new page size. Consumers that drove state throughrouter.push(readinguseSearchParams()inside each handler) silently reverted the size change: the second push reconstructed the URL from a stalesearchParamssnapshot taken before the first push and overwrote the newpageSizeparam.The race surfaced most clearly in the Attack Paths scan selector, where picking a new page size from the "Rows per page" selector appeared to do nothing. The Attack Paths scans pagination fix #10864 carries a short-term
suppressNextPageResetRefworkaround inscan-list-table.tsxso the reported bug is unblocked; that workaround should be removed once this refactor lands.Description
Unify the two callbacks into a single
onPaginationChange(page, pageSize)that always emits the full post-event state. When the user changes the page size,DataTablePaginationnow calls it once with(1, newSize), so the consumer applies both values in a single update and cannot race on a stale snapshot.components/ui/table/data-table-pagination.tsx: replace the two-callback API withonPaginationChange; the size-change branch now emits a single atomic callcomponents/ui/table/data-table.tsx: forward the new prop, refresh the JSDoc examplecomponents/resources/table/resource-detail-content.tsx: collapse the two handlers into oneonPaginationChange(React state batches already prevented a visible race here, but the unified API is cleaner)attack-paths/query-builder/_components/scan-list-table.tsx: switch toonPaginationChangeRelated PR
suppressNextPageResetRefworkaround that lives in fix(ui): load every Attack Paths scan before displaying the selector #10864'sscan-list-table.tsx(tagged with aTODO(#10863)) must be removed and its split handlers replaced with the singleonPaginationChangeadded here.Steps to review
cd ui && pnpm run typecheck— passes.cd ui && pnpm run lint:fix— passes.cd ui && pnpm vitest run— full suite (535 tests) passes./attack-paths/query-builder: with enough scans to trigger the "Rows per page" selector (totalEntries > 10), change the page size. The size change must stick and the table must reset to page 1.Checklist
Community Checklist
UI (if applicable)
License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.