Skip to content

Commit f8a80c4

Browse files
committed
feat(select): invalid v-model with is-multi prop now returns all options
1 parent 2925379 commit f8a80c4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: src/Select.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@ const availableOptions = computed<GenericOption[]>(() => {
7272
}));
7373
7474
// Remove already selected values from the list of options, when in multi-select mode.
75+
// In case an invalid v-model is provided, we return all options since we can't know what options are valid.
7576
const getNonSelectedOptions = (options: GenericOption[]) => options.filter(
76-
(option) => Array.isArray(selected.value) && !selected.value.includes(option.value),
77+
(option) => Array.isArray(selected.value) ? !selected.value.includes(option.value) : true,
7778
);
7879
7980
if (props.isSearchable && search.value) {

0 commit comments

Comments
 (0)