Creating new MR approval rules in Branch rule details duplicates a component
Summary
On Branch rule details page, when a MR approval rule is created, the table row gets duplicated.
We suspect it is related the recent contribution where we introduce an updateRules
action which will update a rule if it exist, or create a new one if it does not exist.
The empty rule component is also added on each branch rule protection edit, so when we query getBranchRulesDetailsEE
.
Steps to reproduce
- Open Rails console. In your terminal:
rails c
- Enable the feature flag:
Feature.enable(:edit_branch_rules)
- In a project, go to Settings / Repository
- Expand Branch rules section
- Click on Add branch rule and select All branches (or create a new rule for a branch that doesn't have MR approval rule yet). You should be redirected to a details page.
- When on details page, add approval rule in Merge request approvals section by increasing All eligible users rule from
0
to1
. - Table row with All eligible users is duplicated, but the rule is created correctly.
- When refreshing the page, the table renders correctly with correct values.
Example Project
What is the current bug behavior?
The rule is created, but upon creation, the component is rendered again.
What is the expected correct behavior?
The number of approvers should persist to the updated value, table row should not be repeated.
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)