From 36c878f392b7ac41c881ea276a11f8a1e76ba2ae Mon Sep 17 00:00:00 2001 From: Esteban Gallego Date: Wed, 26 Jun 2024 13:31:22 -0400 Subject: [PATCH 1/2] Implement check for isMultiSelectDisabled --- src/components/FormSelectList.vue | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/FormSelectList.vue b/src/components/FormSelectList.vue index 9a0d04b..d9aee4f 100644 --- a/src/components/FormSelectList.vue +++ b/src/components/FormSelectList.vue @@ -237,13 +237,22 @@ export default { value: { deep: true, handler(newValue) { - if (newValue && typeof newValue === "object") { + if (newValue && typeof newValue === "object" && this.isMultiSelectDisabled()) { this.updateOption(newValue); } } } }, methods: { + /** + * Checks if multi-select is disabled. + * + * @return {boolean} Returns true if multi-select is disabled, false otherwise. + */ + isMultiSelectDisabled() { + this.options.allowMultiSelect === false; + }, + /** * Updates the specified option with the provided updated value. * @@ -259,7 +268,7 @@ export default { * If the value is an object, it updates the selected option if necessary. */ onSelectListOptionsUpdated() { - if (this.value && typeof this.value === "object") { + if (this.value && typeof this.value === "object" && this.isMultiSelectDisabled()) { this.updateOption(this.value); } }, From 229aaff4db079fa57e83a86a1b4ec6b35c8822e1 Mon Sep 17 00:00:00 2001 From: Esteban Gallego Date: Wed, 26 Jun 2024 14:10:27 -0400 Subject: [PATCH 2/2] SonarQ fix --- src/components/FormSelectList.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/FormSelectList.vue b/src/components/FormSelectList.vue index d9aee4f..6f22011 100644 --- a/src/components/FormSelectList.vue +++ b/src/components/FormSelectList.vue @@ -250,7 +250,7 @@ export default { * @return {boolean} Returns true if multi-select is disabled, false otherwise. */ isMultiSelectDisabled() { - this.options.allowMultiSelect === false; + return this.options.allowMultiSelect === false; }, /**