From 4bee35b0b70d12a03c8c69e6b807f7dbbe9ff2ef Mon Sep 17 00:00:00 2001 From: Shubham Agrawal Date: Tue, 12 Mar 2024 07:30:53 +0530 Subject: [PATCH] lint fix --- src/components/SelectionList/BaseSelectionList.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/SelectionList/BaseSelectionList.tsx b/src/components/SelectionList/BaseSelectionList.tsx index d451168c664f..8c352a4d084a 100644 --- a/src/components/SelectionList/BaseSelectionList.tsx +++ b/src/components/SelectionList/BaseSelectionList.tsx @@ -79,7 +79,7 @@ function BaseSelectionList( const isFocused = useIsFocused(); const [maxToRenderPerBatch, setMaxToRenderPerBatch] = useState(shouldUseDynamicMaxToRenderPerBatch ? 0 : CONST.MAX_TO_RENDER_PER_BATCH.DEFAULT); const [isInitialSectionListRender, setIsInitialSectionListRender] = useState(true); - const [itemToHighlight, setItemToHighlight] = useState | null>(null); + const [itemsToHighlight, setItemsToHighlight] = useState | null>(null); const itemFocusTimeoutRef = useRef(null); /** @@ -281,7 +281,7 @@ function BaseSelectionList( const indexOffset = section.indexOffset ? section.indexOffset : 0; const normalizedIndex = index + indexOffset; const isDisabled = !!section.isDisabled || item.isDisabled; - const isItemFocused = !isDisabled && (focusedIndex === normalizedIndex || itemToHighlight?.has(item.keyForList)); + const isItemFocused = !isDisabled && (focusedIndex === normalizedIndex || itemsToHighlight?.has(item.keyForList ?? '')); // We only create tooltips for the first 10 users or so since some reports have hundreds of users, causing performance to degrade. const showTooltip = shouldShowTooltips && normalizedIndex < 10; @@ -390,9 +390,9 @@ function BaseSelectionList( items.forEach((item) => { newItemsToHighlight.add(item); }); - const index = flattenedSections.allOptions.findIndex((option) => newItemsToHighlight.has(option.keyForList)); + const index = flattenedSections.allOptions.findIndex((option) => newItemsToHighlight.has(option.keyForList ?? '')); updateAndScrollToFocusedIndex(index); - setItemToHighlight(newItemsToHighlight); + setItemsToHighlight(newItemsToHighlight); if (itemFocusTimeoutRef.current) { clearTimeout(itemFocusTimeoutRef.current); @@ -400,7 +400,7 @@ function BaseSelectionList( itemFocusTimeoutRef.current = setTimeout(() => { setFocusedIndex(-1); - setItemToHighlight(null); + setItemsToHighlight(null); }, timeout); }, [flattenedSections.allOptions, updateAndScrollToFocusedIndex],