From c747e344bfd967c4244c0e787f0c85ceaab4100e Mon Sep 17 00:00:00 2001 From: Dominik Prokop Date: Tue, 14 May 2024 17:16:00 +0200 Subject: [PATCH] SelectMenu: Fix potential undefined problem (#87835) --- packages/grafana-ui/src/components/Select/SelectMenu.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/grafana-ui/src/components/Select/SelectMenu.tsx b/packages/grafana-ui/src/components/Select/SelectMenu.tsx index 0da2f654a1e..593e72866a4 100644 --- a/packages/grafana-ui/src/components/Select/SelectMenu.tsx +++ b/packages/grafana-ui/src/components/Select/SelectMenu.tsx @@ -57,7 +57,7 @@ export const VirtualizedSelectMenu = ({ const styles = getSelectStyles(theme); const listRef = useRef(null); - const focusedIndex = options.findIndex((option: SelectableValue) => option.value === focusedOption.value); + const focusedIndex = options.findIndex((option: SelectableValue) => option.value === focusedOption?.value); useEffect(() => { listRef.current?.scrollToItem(focusedIndex);