Repository navigation
Fix duplicated resource on current and next page in Auth Resources - #47446
Merged
Merged
Conversation
The Authorization Resources table was incorrectly duplicating the last element of the current page as the first element of the next page. This occurred because the fetching logic requests 'max + 1' items to detect if a subsequent page exists. However, the UI was rendering the entire array instead of limiting the display to the 'max' value. Fixed by applying a .slice(0, max) before mapping the resources to table rows. Added a Playwright E2E regression test to ensure unique resource distribution across pages and prevent future regressions. Closes #46088 Signed-off-by: André Rocha <andre.queiroz.rocha@tecnico.ulisboa.pt>
Contributor
Author
|
I'm following up on this PR as it addresses the duplicated resource bug in the Authorization Resources list. Since you are the main contributors to this file, I was wondering if you could provide some feedback or review the proposed fix. Please let me know if any further adjustments are needed to get this merged. Thanks! |
Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
ahus1
approved these changes
Apr 17, 2026
Member
There was a problem hiding this comment.
Thank you for this PR, great to see this one fixed!
Closed
sashyo
pushed a commit
to tide-foundation/keycloak-IGA
that referenced
this pull request
Jul 20, 2026
…eycloak#47446) The Authorization Resources table was incorrectly duplicating the last element of the current page as the first element of the next page. This occurred because the fetching logic requests 'max + 1' items to detect if a subsequent page exists. However, the UI was rendering the entire array instead of limiting the display to the 'max' value. Fixed by applying a .slice(0, max) before mapping the resources to table rows. Added a Playwright E2E regression test to ensure unique resource distribution across pages and prevent future regressions. Closes keycloak#46088 --------- Signed-off-by: André Rocha <andre.queiroz.rocha@tecnico.ulisboa.pt> Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com> Co-authored-by: Alexander Schwartz <alexander.schwartz@ibm.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.
Closes: #46088
The data duplication issue in the Authorization Resources table occurred due to the pagination fetch logic. The useFetch hook is designed to request max + 1 items from the API to determine if a "Next" page exists. However, the UI was incorrectly rendering the entire returned array instead of limiting the display to the max value defined for the current page. As a result, the (N+1)-th item (which should only serve as a pagination indicator) was being displayed as the last item of the current page and then again as the first item of the next page.
To fix this issue, I implemented a .slice(0, max) on the resources array in Resources.tsx before mapping the data to the table rows. This ensures that even though N+1 items are fetched for background logic, only N items are rendered to the user, maintaining data uniqueness across paginated views.
For testing, I created 11 resources and verified that no duplication occurs when navigating between Page 1 and Page 2, and added a new Playwright E2E test in authorization.spec.ts that programmatically verifies the correct distribution of 11 resources across two pages.