Fix project permission toggle behavior
What does this MR do and why?
Problem:
Given that you are on public project
When you disable a permission
And enable it again
Then the dropdown shows that you selected the last value on the list
While the internal input has another value set.
This has to do with a quirky behavior where we replace the value
and
the options
provided to the <select>
inside of the
ProjectFeatureSettings input component. Internally we used the
selected
attribute of the <option>
elements to track which option
was selected. That attribute is just for initial rendering though:
If present, this Boolean attribute indicates that the option is initially selected. If the
<option>
element is the descendant of a<select>
element whose multiple attribute is not set, only one single<option>
of this<select>
element may have the selected attribute.
This seems to be non-problematic if one never changes the options that are availabe for the specific select.
The solution for this is to create a computed property with a getter and setter and use that computed property as a v-model for the internal select.
Changelog: fixed
Screenshots or screen recordings
Before | After |
---|---|
before | after |
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #351200 (closed)