fix: selected values must be at the start of the dropdown

This commit is contained in:
Mauricio Navarro Miranda 2020-08-09 23:16:58 -05:00 committed by Josh Harvey
parent ef9f8b49a6
commit ddf488e3b7

View file

@ -42,10 +42,15 @@ const Autocomplete = ({
onChange(evt, rValue)
}
const filterOptions = (options, { inputValue }) =>
sort(options, inputValue, { keys: ['code', 'display'] }).slice(
const valueArray = () => (multiple ? value : [value])
const filter = (array, input) =>
sort(array, input, { keys: ['code', 'display'] })
const filterOptions = (array, { inputValue }) =>
R.union(valueArray(), filter(array, inputValue)).slice(
0,
R.defaultTo(undefined)(limit)
R.defaultTo(undefined)(limit) && Math.max(limit, valueArray().length)
)
return (