Skip to content

Commit

Permalink
add comment to resolveOptions in BasicEntityAutocompleteField
Browse files Browse the repository at this point in the history
  • Loading branch information
zackatbrightbeam committed Jul 25, 2024
1 parent 9ade7be commit d80ae75
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lib/BasicEntityAutocompleteField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,15 @@ function BasicEntityAutocompleteField(props: any) {
)
}

// Returns array of options and default value(s) based on the options object
function resolveOptions(options: any) {
// Array of options
const resolvedOptions = Object.keys(options.ents).map(key => ({
label: options.ents[key].label,
value: key
}))

// Array of default values (or single value if multiple is false)
const resolvedDefault = options.multiple === false ? (
Object.keys(options.default).length > 0
? { value: Object.keys(options.default)[0], label: options.default[Object.keys(options.default)[0]].label }
Expand Down

0 comments on commit d80ae75

Please sign in to comment.