Skip to content

Commit

Permalink
Handle case where multi is true and value is not an array.
Browse files Browse the repository at this point in the history
  • Loading branch information
T4rk1n committed Apr 20, 2022
1 parent 6422036 commit 0801dad
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const Dropdown = props => {
return [
sanitized,
createFilterOptions({
options: options,
options: sanitized,
tokenizer: TOKENIZER,
}),
];
Expand Down Expand Up @@ -82,7 +82,7 @@ const Dropdown = props => {
useEffect(() => {
if (optionsCheck !== sanitizedOptions && !isNil(value)) {
const values = sanitizedOptions.map(option => option.value);
if (multi) {
if (multi && Array.isArray(value)) {
const invalids = value.filter(v => !values.includes(v));
if (invalids.length) {
setProps({value: without(invalids, value)});
Expand Down

0 comments on commit 0801dad

Please sign in to comment.