mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-07 12:02:44 +00:00
prevent crash if desired attr is not available.
This commit is contained in:
@@ -87,9 +87,9 @@ const Combobox = createClass({
|
|||||||
const filteredArrays = filterOn.map((attr)=>{
|
const filteredArrays = filterOn.map((attr)=>{
|
||||||
const children = dropdownChildren.filter((item)=>{
|
const children = dropdownChildren.filter((item)=>{
|
||||||
if(suggestMethod === 'includes'){
|
if(suggestMethod === 'includes'){
|
||||||
return item.props[attr].toLowerCase().includes(this.state.value.toLowerCase());
|
return item.props[attr]?.toLowerCase().includes(this.state.value.toLowerCase());
|
||||||
} else if(suggestMethod === 'startsWith'){
|
} else if(suggestMethod === 'startsWith'){
|
||||||
return item.props[attr].toLowerCase().startsWith(this.state.value.toLowerCase());
|
return item.props[attr]?.toLowerCase().startsWith(this.state.value.toLowerCase());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return children;
|
return children;
|
||||||
|
|||||||
Reference in New Issue
Block a user