prevent undefined on no matching elements

This commit is contained in:
Andre Landgraf 2019-06-13 18:01:07 +02:00
parent 352eba6643
commit 593c9e6cd4

View File

@ -32,12 +32,16 @@ class DataListInput extends React.Component {
if ( typeof ( match ) === typeof ( Function ) ) { return match( currentInput, item ); }
return this.match( currentInput, item );
} );
this.setState( {
currentInput,
matchingItems,
focusIndex: 0,
visible: true,
} );
if( matchingItems.length > 0) {
this.setState( {
currentInput,
matchingItems,
focusIndex: 0,
visible: true,
} );
} else {
his.setState( { currentInput } )
}
};
/**