Skip to content

Commit

Permalink
reset emoji index, fix crash
Browse files Browse the repository at this point in the history
  • Loading branch information
hannojg committed Aug 15, 2023
1 parent 8554863 commit e209754
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/pages/home/report/ReportActionCompose.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ function ReportActionCompose({
const isEmojiSuggestionsMenuVisible = !_.isEmpty(suggestionValues.suggestedEmojis) && suggestionValues.shouldShowEmojiSuggestionMenu;
const isMentionSuggestionsMenuVisible = !_.isEmpty(suggestionValues.suggestedMentions) && suggestionValues.shouldShowMentionSuggestionMenu;

const [highlightedEmojiIndex] = useArrowKeyFocusManager({
const [highlightedEmojiIndex, setHighlightedEmojiIndex] = useArrowKeyFocusManager({
isActive: isEmojiSuggestionsMenuVisible,
maxIndex: getMaxArrowIndex(suggestionValues.suggestedEmojis.length, suggestionValues.isAutoSuggestionPickerLarge),
shouldExcludeTextAreaNodes: false,
Expand Down Expand Up @@ -532,8 +532,9 @@ function ReportActionCompose({
}

setSuggestionValues((prevState) => ({...prevState, ...nextState}));
setHighlightedEmojiIndex(0);
},
[value, windowHeight, isSmallScreenWidth, preferredLocale, composerHeight],
[value, windowHeight, composerHeight, isSmallScreenWidth, preferredLocale, setHighlightedEmojiIndex],
);

const getMentionOptions = useCallback(
Expand Down

0 comments on commit e209754

Please sign in to comment.