Paginate Project > Members > Group tab
What does this MR do and why?
Add pagination to Project > Members > Groups tab to prevent timeouts due to loading large amount of data at once.
This MR touches a lot of old code which resulted into a relatively complex change. I categorized the changes in the commits to hopefully make it easier to review:
- Add
paginate_group_membersfeature flag - Create methods/scopes to return group links with highest access level
- Create custom collection model with pagination info for group links
- Paginate the Project > Group members page
Note: There is a known bug in the frontend where the page number doesn't change when switching tabs. This would be tackled in a follow up to avoid increasing the size of this MR further.
Query Plans
Direct Members
Inherited Members
References
- Related to #581339
- Follow up for frontend: Project Members page should reset page number w... (#585957)
Screenshots or screen recordings
| Before | After |
|---|---|
|
|
How to set up and validate locally
- Enable the
paginate_group_membersfeature flag - Go to
Project > Manage > Members > Groupstab. - Invite 20+ groups into the project or apply the the following patch to limit the page size:
Index: app/controllers/projects/project_members_controller.rb
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/app/controllers/projects/project_members_controller.rb b/app/controllers/projects/project_members_controller.rb
--- a/app/controllers/projects/project_members_controller.rb (revision cd37516d89eff4154b9ac6783d71a598b414075f)
+++ b/app/controllers/projects/project_members_controller.rb (date 1768363842282)
@@ -48,13 +48,14 @@
end
def group_member_links
- paginator = Gitlab::MultiCollectionPaginator.new(project_group_links, group_group_links)
+ paginator = Gitlab::MultiCollectionPaginator.new(project_group_links, group_group_links, per_page: 5)
result = paginator.paginate(pagination_params[:page])
Members::GroupLinksCollection.new(
result,
page: pagination_params[:page].to_i,
- total_count: paginator.total_count
+ total_count: paginator.total_count,
+ per_page: 5
)
end
Note: You may invite groups into the project or its ancestor groups to test out different cases.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #581339
Edited by Shane Maglangit

