Skip to content

Commit

Permalink
fix: use undefined as standard for no selection in single mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Merlin Flach authored and OrbisK committed Dec 15, 2022
1 parent f1cbd89 commit f5a95ee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/useOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function useOptions(multiple: Ref<boolean>,
tempValue.value = [...value]
}
else {
value = null
value = undefined
if (options.length > 0)
value = optionValue.value(options[0])
tempValue.value = value
Expand Down Expand Up @@ -125,7 +125,7 @@ export default function useOptions(multiple: Ref<boolean>,

watch(optionMap, (newMap, oldMap) => {
if (!_.isEqual(newMap, oldMap))
selectedOptions.value = _.isArray(modelValue.value) ? modelValue.value : [modelValue.value]
selectedOptions.value = multiple.value ? modelValue.value : modelValue.value !== undefined ? [modelValue.value] : []
})

function select(option: Option | unknown) {
Expand Down

0 comments on commit f5a95ee

Please sign in to comment.