Skip to content

Commit fb65769

Browse files
committedFeb 13, 2024·
Comment explaining function validateValueAvailability. Items are fetched in init function, not necessary to fetch in render.
1 parent 5241dc0 commit fb65769

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed
 

‎mocks/mocks/data/formio-api/form-select-v1.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
"customPrivate": false,
4141
"strictDateValidation": false,
4242
"multiple": false,
43-
"unique": false
43+
"unique": false,
44+
"onlyAvailableItems": true
4445
},
4546
"label": "Velg instrument",
4647
"key": "velgInstrument",

‎mocks/mocks/data/formio-api/form-select-v2.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
"customPrivate": false,
4141
"strictDateValidation": false,
4242
"multiple": false,
43-
"unique": false
43+
"unique": false,
44+
"onlyAvailableItems": true
4445
},
4546
"label": "Velg instrument",
4647
"key": "velgInstrument",

‎packages/shared-components/src/formio/components/core/select/Select.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,12 @@ class NavSelect extends BaseComponent {
194194
return this.dataReady.then(() => this);
195195
}
196196

197+
/**
198+
* Denne funksjonen kalles fra formio sin valideringskode når validator 'onlyAvailableItems' er aktivert.
199+
*
200+
* @param setting Komponent-egenskap 'validate.onlyAvailableItems'
201+
* @param value Verdi som skal valideres
202+
*/
197203
validateValueAvailability(setting, value) {
198204
if (!Utils.boolValue(setting) || !value) {
199205
return true;
@@ -206,9 +212,7 @@ class NavSelect extends BaseComponent {
206212
}
207213

208214
renderReact(element) {
209-
this.loadItems();
210215
const component = this.component!;
211-
212216
return element.render(
213217
<ReactSelectWrapper
214218
component={component}

0 commit comments

Comments
 (0)
Please sign in to comment.