Open svandenhoek opened 4 days ago
Changes:
required
(as otherwise a modelvalue
will not be set even though in the drop-down menu it seems the first option is selected)Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
What are the main changes you did:
Using http://localhost:8080/apps/molgenis-components/#/component/InputSelect & http://localhost:8080/apps/central/#/ to explain changes.
Old behavior
1)
required
showed the first element was automatically selected, yet nomodelvalue
was set and the first element could only be selected by first selecting another option and then selecting the first one again.https://github.com/molgenis/molgenis-emx2/assets/7658246/f8f52384-8241-4631-8157-2d11a20107f6
2) If no
required
&v-model=null
,modelvalue
is not set. However, if selecting another option and the selecting the empty option again, it becomesmodelvalue=""
instead.https://github.com/molgenis/molgenis-emx2/assets/7658246/87aaf9bb-8c11-4f06-a043-9d8fcea3ac96
This caused issues in f.e. Database creation with no template:
https://github.com/molgenis/molgenis-emx2/assets/7658246/795c5491-3628-4a94-b7c2-783196cef2d3
3) There was a duplicate empty value when creating a new Database.
New behavior
1) If
required
, an$emit("update:modelValue"
is triggered at<select :modelValue=
to update it to the first item inoptions
instead (simply returning the new value without an update showed the outdated value still in HTML).2) If a
@change
is detected with a$event.target.value ==''
,$emit("update:modelValue", null)
is done instead of using the actual value. This causes themodelvalue
attribute to be removed fromselect
, similar to if no value was selected yet.https://github.com/molgenis/molgenis-emx2/assets/7658246/8c83380d-ac16-4e58-bd4f-2af2a80fd946
3) Removed the
null
fromoptions
when creating a new Database, as a placeholder option is already generated when not usingrequired
.how to test:
Selected:
is equal to what is actually selected in the drop-down menu.Selected:
is equal to themodelvalue
as shown in the HTML (browser developer tools).modelvalue
attribute is not present if the blank value is selected, even after selecting other values.todo: