Skip to content

Commit 9c79444

Browse files
committed
fix: don't throw error on empty endpoint options
1 parent 56903b8 commit 9c79444

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/composables/useOptions.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -634,9 +634,14 @@ export default function useOptions (props, context, dep)
634634
}
635635

636636
// Transforming an plain arrays to an array of objects
637-
uo = uo.map((val) => {
638-
return typeof val === 'object' ? val : { [valueProp.value]: val, [trackBy.value[0]]: val, [label.value]: val}
639-
})
637+
/* istanbul ignore else */
638+
if (uo && Array.isArray(uo)) {
639+
uo = uo.map((val) => {
640+
return typeof val === 'object' ? val : { [valueProp.value]: val, [trackBy.value[0]]: val, [label.value]: val}
641+
})
642+
} else {
643+
uo = []
644+
}
640645

641646
return uo
642647
}

0 commit comments

Comments
 (0)