diff --git a/src/pages/home/report/ReportActionCompose/Suggestions.js b/src/pages/home/report/ReportActionCompose/Suggestions.js index 0050b56800cc..05f35713c5f8 100644 --- a/src/pages/home/report/ReportActionCompose/Suggestions.js +++ b/src/pages/home/report/ReportActionCompose/Suggestions.js @@ -46,7 +46,23 @@ function Suggestions({ const suggestionEmojiRef = useRef(null); const suggestionMentionRef = useRef(null); - const getSuggestions = useCallback(() => suggestionEmojiRef.current.getSuggestions() || suggestionMentionRef.current.getSuggestions(), []); + const getSuggestions = useCallback(() => { + if (suggestionEmojiRef.current && suggestionEmojiRef.current.getSuggestions) { + const emojiSuggestions = suggestionEmojiRef.current.getSuggestions(); + if (emojiSuggestions.length > 0) { + return emojiSuggestions; + } + } + + if (suggestionMentionRef.current && suggestionMentionRef.current.getSuggestions) { + const mentionSuggestions = suggestionMentionRef.current.getSuggestions(); + if (mentionSuggestions.length > 0) { + return mentionSuggestions; + } + } + + return []; + }, []); /** * Clean data related to EmojiSuggestions