Skip to content

Commit

Permalink
Fix AutoComplete highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Jul 31, 2024
1 parent a4f4ee8 commit ac3e7ec
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions components/lib/autocomplete/AutoComplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,12 +476,6 @@ export const AutoComplete = React.memo(
ObjectUtils.combinedRefs(inputRef, props.inputRef);
}, [inputRef, props.inputRef]);

React.useEffect(() => {
if (searchingState && props.autoHighlight && props.suggestions && props.suggestions.length) {
autoHighlightFirstOption();
}
}, [searchingState]);

useMountEffect(() => {
if (!idState) {
setIdState(UniqueComponentId());
Expand All @@ -494,6 +488,12 @@ export const AutoComplete = React.memo(
alignOverlay();
});

useUpdateEffect(() => {
if (searchingState && props.autoHighlight && props.suggestions && props.suggestions.length) {
autoHighlightFirstOption();
}
}, [searchingState]);

useUpdateEffect(() => {
if (searchingState) {
ObjectUtils.isNotEmpty(props.suggestions) || props.showEmptyMessage ? show() : hide();
Expand Down

0 comments on commit ac3e7ec

Please sign in to comment.