Skip to content

Commit

Permalink
fix: Optimize dropdown items rendering on mouse hover (#3102)
Browse files Browse the repository at this point in the history
  • Loading branch information
just-boris authored Dec 6, 2024
1 parent 6006683 commit 830d07f
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ export function useHighlightedOption<OptionType>({
}: HighlightedOptionProps<OptionType>): [HighlightedOptionState<OptionType>, HighlightedOptionHandlers<OptionType>] {
const [highlightedIndex, setHighlightedIndexState] = useState(-1);
const [highlightType, setHighlightType] = useState<HighlightType>(new HighlightType('keyboard'));
const setHighlightedIndex = useCallback((index: number, highlightType: HighlightType) => {
const setHighlightedIndex = useCallback((index: number, newHighlightType: HighlightType) => {
setHighlightedIndexState(index);
setHighlightType(highlightType);
setHighlightType(oldHighlight => (oldHighlight.type !== newHighlightType.type ? newHighlightType : oldHighlight));
}, []);

const highlightedOption =
Expand Down

0 comments on commit 830d07f

Please sign in to comment.