fix findDropDownItemIndex bug (#15642)

This commit is contained in:
brian-harris
2021-06-09 12:11:19 -07:00
committed by GitHub
parent 95704dc45e
commit 7256bff094
2 changed files with 18 additions and 15 deletions

View File

@@ -130,7 +130,10 @@ export function selectDropDownIndex(dropDown: DropDownComponent, index: number):
}
export function findDropDownItemIndex(dropDown: DropDownComponent, value: string): number {
return dropDown.values &&
dropDown.values.findIndex((v: any) => ((v as CategoryValue)?.displayName?.toLowerCase() === value?.toLowerCase())) ||
-1;
if (dropDown.values) {
return dropDown.values.findIndex((v: any) =>
(v as CategoryValue)?.displayName?.toLowerCase() === value?.toLowerCase());
}
return -1;
}