Skip to content

Commit b755103

Browse files
committed
fix: issue #4301
1 parent 59fa185 commit b755103

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/components/TeamManagement/AutocompleteInputContainer.jsx

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,20 @@ class AutocompleteInputContainer extends React.Component {
6969
this.clearUserSuggestions()
7070
}
7171

72-
handleInputBlur() {
73-
const innerSelectInstance = this.selectInstance.select.select
74-
const focusedOption = innerSelectInstance.state.focusedOption
75-
// current input value
76-
const inputValue = this.selectInstance.state.inputValue
77-
if (inputValue && focusedOption) {
78-
innerSelectInstance.selectOption(focusedOption)
72+
handleInputBlur(event) {
73+
const {
74+
selectedMembers
75+
} = this.props
76+
const value = event.target.value
77+
const innerSelectInstance = this.selectInstance.select
78+
79+
if (value) {
80+
const hasExist = _.find(selectedMembers, ({label}) => label === value)
81+
if (!hasExist) {
82+
// format new option from input value
83+
const newOption = {value, label: value}
84+
innerSelectInstance.select.selectOption(newOption)
85+
}
7986
}
8087
}
8188

0 commit comments

Comments
 (0)