Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/components/inputs/company-input-v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,21 @@ const CompanyInputV2 = ({ summitId, isRequired, sx, onChange, id, name, label, v
}}
onChange={(_, newValue) => {
let tmpValue = newValue?.inputValue || newValue;
// empty option
if (newValue === null) {
tmpValue = { id: null, name: '' };
}
// if the company name is a string
else if (typeof newValue === 'string') {
tmpValue = { id: 0, name: newValue };
}
// if new option is selected ...
if (newValue && typeof newValue === 'object' && newValue.inputValue) {
else if (newValue && typeof newValue === 'object' && newValue.inputValue) {
tmpValue = {
id: 0,
name: newValue.inputValue
};
}
}
setOptions(tmpValue ? [tmpValue, ...options] : options);
let ev = {
target: {
Expand Down