Skip to content

Commit

Permalink
Fix #3038: Dropdown matchSearchValue prevent error (#3041)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Jul 6, 2022
1 parent d704f0b commit 23ad0fa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion components/lib/dropdown/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,11 @@ export const Dropdown = React.memo(React.forwardRef((props, ref) => {
}

const matchesSearchValue = (option) => {
const label = getOptionLabel(option).toLocaleLowerCase(props.filterLocale);
let label = getOptionLabel(option);
if (!label) {
return false;
}
label = label.toLocaleLowerCase(props.filterLocale);
return label.startsWith(searchValue.current.toLocaleLowerCase(props.filterLocale));
}

Expand Down

0 comments on commit 23ad0fa

Please sign in to comment.