Skip to content

Commit

Permalink
Merge pull request #787 from Orfium/fix/NDS-981_select_new_option_lab…
Browse files Browse the repository at this point in the history
…el_error

[NDS-981] fix: select new option label error
  • Loading branch information
kostasdano authored Mar 14, 2024
2 parents f4af4c3 + b9284c4 commit bcd0a83
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/components/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,18 @@ const Select = React.forwardRef<HTMLInputElement, SelectProps>((props, ref) => {
}
} else {
if (onChange) {
// @ts-ignore
onChange(option);
if (option.isCreated) {
const newOption: SelectOption = {
value: option.value,
label: option.value.toString(),
isCreated: true,
};
// @ts-ignore because TS doesnt recognize both (single-select) and (multi-select) option that we set
onChange(newOption);
} else {
// @ts-ignore
onChange(option);
}
}
}

Expand Down

0 comments on commit bcd0a83

Please sign in to comment.