File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed
src/components/TeamManagement Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments