File tree Expand file tree Collapse file tree
x-pack/legacy/plugins/uptime/public/components/functional/kuery_bar/typeahead Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ export class Typeahead extends Component {
2727 index : null ,
2828 value : '' ,
2929 inputIsPristine : true ,
30+ lastSubmitted : '' ,
3031 } ;
3132
3233 static getDerivedStateFromProps ( props , state ) {
@@ -151,7 +152,10 @@ export class Typeahead extends Component {
151152 } ;
152153
153154 onSubmit = ( ) => {
154- this . props . onSubmit ( this . state . value ) ;
155+ if ( this . state . lastSubmitted !== this . state . value ) {
156+ this . props . onSubmit ( this . state . value ) ;
157+ this . setState ( { lastSubmitted : this . state . value } ) ;
158+ }
155159 this . setState ( { isSuggestionsVisible : false } ) ;
156160 } ;
157161
@@ -177,6 +181,7 @@ export class Typeahead extends Component {
177181 value = { this . state . value }
178182 onKeyDown = { this . onKeyDown }
179183 onKeyUp = { this . onKeyUp }
184+ onBlur = { this . onSubmit }
180185 onChange = { this . onChangeInputValue }
181186 onClick = { this . onClickInput }
182187 autoComplete = "off"
You can’t perform that action at this time.
0 commit comments