From 9c7944447960a5e32ab704781bbd3b7afb4ae196 Mon Sep 17 00:00:00 2001 From: Adam Berecz Date: Sat, 23 Nov 2024 17:14:52 +0100 Subject: [PATCH] fix: don't throw error on empty endpoint options --- src/composables/useOptions.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/composables/useOptions.js b/src/composables/useOptions.js index 87ae129..da8b003 100644 --- a/src/composables/useOptions.js +++ b/src/composables/useOptions.js @@ -634,9 +634,14 @@ export default function useOptions (props, context, dep) } // Transforming an plain arrays to an array of objects - uo = uo.map((val) => { - return typeof val === 'object' ? val : { [valueProp.value]: val, [trackBy.value[0]]: val, [label.value]: val} - }) + /* istanbul ignore else */ + if (uo && Array.isArray(uo)) { + uo = uo.map((val) => { + return typeof val === 'object' ? val : { [valueProp.value]: val, [trackBy.value[0]]: val, [label.value]: val} + }) + } else { + uo = [] + } return uo }