Skip to content

Commit

Permalink
Reset page when changing membership type
Browse files Browse the repository at this point in the history
The page index doesn't reset when changing
the membership type, causing pagination errors
and empty pages if the number of elements between
`direct` and `indirect` don't match.

E.g., In 'Is a member of' section > 'User groups'
tab, there are 12 elements in the direct table
and 3 elements in the indirect one. The pagination
is limited to 10 elements per page, and membership is
set to `Direct`. The table elements dissapear when
moving to the second page and changing the type to
indirect.

Fixes: freeipa#346
Signed-off-by: Carla Martinez <[email protected]>
  • Loading branch information
carma12 committed Apr 22, 2024
1 parent 7c4f8fc commit 9521970
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/components/MemberOf/MemberOfNetgroups.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ const memberOfNetgroups = (props: MemberOfNetroupsProps) => {
} else {
setShownNetgroups(netgroupsFromUser);
}
setPage(1);
}, [membershipDirection, props.user]);

// Buttons functionality
Expand Down
1 change: 1 addition & 0 deletions src/components/MemberOf/MemberOfUserGroups.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ const MemberOfUserGroups = (props: MemberOfUserGroupsProps) => {
} else {
setShownUserGroups(userGroupsFromUser);
}
setPage(1);
}, [membershipDirection, props.user]);

// Buttons functionality
Expand Down

0 comments on commit 9521970

Please sign in to comment.