From 2e184c679786bda8f428ae3f58d7e0729a162784 Mon Sep 17 00:00:00 2001 From: Aldo Canepa Date: Thu, 20 Jun 2024 12:26:18 -0700 Subject: [PATCH] Disable mention suggestion box if selecting text --- .../home/report/ReportActionCompose/SuggestionMention.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/SuggestionMention.tsx b/src/pages/home/report/ReportActionCompose/SuggestionMention.tsx index 0b430a519812..129c8c822d74 100644 --- a/src/pages/home/report/ReportActionCompose/SuggestionMention.tsx +++ b/src/pages/home/report/ReportActionCompose/SuggestionMention.tsx @@ -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; @@ -384,7 +384,7 @@ function SuggestionMention( ); useEffect(() => { - calculateMentionSuggestion(selection.end); + calculateMentionSuggestion(selection.start, selection.end); }, [selection, calculateMentionSuggestion]); useEffect(() => {