SelectMenu: Fix potential undefined problem (#87835)

This commit is contained in:
Dominik Prokop
2024-05-14 18:16:00 +03:00
committed by GitHub
parent ea1845edbe
commit c747e344bf
@@ -57,7 +57,7 @@ export const VirtualizedSelectMenu = ({
const styles = getSelectStyles(theme);
const listRef = useRef<List>(null);
const focusedIndex = options.findIndex((option: SelectableValue<unknown>) => option.value === focusedOption.value);
const focusedIndex = options.findIndex((option: SelectableValue<unknown>) => option.value === focusedOption?.value);
useEffect(() => {
listRef.current?.scrollToItem(focusedIndex);