Skip to content

Commit

Permalink
fix: don't throw error on empty endpoint options
Browse files Browse the repository at this point in the history
  • Loading branch information
adamberecz committed Nov 23, 2024
1 parent 56903b8 commit 9c79444
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/composables/useOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 9c79444

Please sign in to comment.