Unable to view/edit Branch Rules in UI if over 100 branch rules
Summary
Only the first 100 branch rules for a project are returned by getBranchRulesEE. This is confirmed by checking the JSON payload. The default_max_page_size of 100 seems to be applied.
For customers with more than 100 branch rules for a project, they are unable to view or edit these via the UI, as the UI receives only the first 100 from the GraphQL query.
When this was in the Protected Branches section, it had pagination. This has since moved to Branch Rules, which has no pagination.
If I emulate the resolver logic, I get more than 100:
irb(main):006> protected_branches = project.all_protected_branches.sorted_by_name
=>
[#<ProtectedBranch:0x00007f1d8a7f35d8
...
irb(main):007* branch_rules = protected_branches.map do |protected_branch|
irb(main):008* ::Projects::BranchRule.new(project, protected_branch)
irb(main):009> end
=>
[#<Projects::BranchRule:0x00007f1d863443d8
...
irb(main):010> branch_rules.count
=> 107
Steps to reproduce
- Create more than 100 branch rules for a project
- Go to Settings > Repository > Branch Rules
Example Project
What is the current bug behavior?
Only 100 are returned in the UI, and there's no pagination.
What is the expected correct behavior?
Either the limit is increased, or pagination exists to view/edit all rules.
Proposal
- Implement pagination using the built-in functionality with crud component.
- Default Page Size: 20 - this aligns with other pagination defaults
- Order criteria: TBD
Edited by Chaoyue Zhao