SelectMenu: Fix potential undefined problem (#87835)

pull/87555/head
Dominik Prokop 1 year ago committed by GitHub
parent ea1845edbe
commit c747e344bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      packages/grafana-ui/src/components/Select/SelectMenu.tsx

@ -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);

Loading…
Cancel
Save