Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ function SuggestionEmoji(
* Calculates and cares about the content of an Emoji Suggester
*/
const calculateEmojiSuggestion = useCallback(
(selectionEnd?: number) => {
if (!selectionEnd || shouldBlockCalc.current || !value) {
(selectionStart?: number, selectionEnd?: number) => {
if (selectionStart !== selectionEnd || !selectionEnd || shouldBlockCalc.current || !value) {
shouldBlockCalc.current = false;
resetSuggestions();
return;
Expand Down Expand Up @@ -181,7 +181,7 @@ function SuggestionEmoji(
if (!isComposerFocused) {
return;
}
calculateEmojiSuggestion(selection.end);
calculateEmojiSuggestion(selection.start, selection.end);
}, [selection, calculateEmojiSuggestion, isComposerFocused]);

const setShouldBlockSuggestionCalc = useCallback(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ function SuggestionMention(
);

const calculateMentionSuggestion = useCallback(
(selectionEnd?: number) => {
if (!selectionEnd || shouldBlockCalc.current || selectionEnd < 1 || !isComposerFocused) {
(selectionStart?: number, selectionEnd?: number) => {
if (selectionEnd !== selectionStart || !selectionEnd || shouldBlockCalc.current || selectionEnd < 1 || !isComposerFocused) {
shouldBlockCalc.current = false;
resetSuggestions();
return;
Expand Down Expand Up @@ -384,7 +384,7 @@ function SuggestionMention(
);

useEffect(() => {
calculateMentionSuggestion(selection.end);
calculateMentionSuggestion(selection.start, selection.end);
}, [selection, calculateMentionSuggestion]);

useEffect(() => {
Expand Down