@@ -92,7 +92,7 @@ function SuggestionMention(
92
92
// eslint-disable-next-line react-compiler/react-compiler
93
93
suggestionValuesRef . current = suggestionValues ;
94
94
95
- const [ reports ] = useOnyx ( ONYXKEYS . COLLECTION . REPORT , { canBeMissing : false } ) ;
95
+ const [ reports ] = useOnyx ( ONYXKEYS . COLLECTION . REPORT ) ;
96
96
97
97
const currentUserPersonalDetails = useCurrentUserPersonalDetails ( ) ;
98
98
const isMentionSuggestionsMenuVisible = ! ! suggestionValues . suggestedMentions . length && suggestionValues . shouldShowSuggestionMenu ;
@@ -190,15 +190,6 @@ function SuggestionMention(
190
190
[ formatLoginPrivateDomain ] ,
191
191
) ;
192
192
193
- function getOriginalMentionText ( inputValue : string , atSignIndex : number ) {
194
- const rest = inputValue . slice ( atSignIndex ) ;
195
-
196
- const breakerIndex = rest . search ( CONST . REGEX . MENTION_BREAKER ) ;
197
-
198
- // If no breaker is found, return the entire rest of the string
199
- return breakerIndex === - 1 ? rest : rest . slice ( 0 , breakerIndex ) ;
200
- }
201
-
202
193
/**
203
194
* Replace the code of mention and update selection
204
195
*/
@@ -210,8 +201,8 @@ function SuggestionMention(
210
201
return ;
211
202
}
212
203
const mentionCode = getMentionCode ( mentionObject , suggestionValues . prefixType ) ;
213
- const originalMention = getOriginalMentionText ( value , suggestionValues . atSignIndex ) ;
214
- const commentAfterMention = value . slice ( suggestionValues . atSignIndex + originalMention . length ) ;
204
+ const commentAfterMention = value . slice ( suggestionValues . atSignIndex + suggestionValues . mentionPrefix . length + 1 ) ;
205
+
215
206
updateComment ( `${ commentBeforeAtSign } ${ mentionCode } ${ trimLeadingSpace ( commentAfterMention ) } ` , true ) ;
216
207
const selectionPosition = suggestionValues . atSignIndex + mentionCode . length + CONST . SPACE_LENGTH ;
217
208
setSelection ( {
@@ -225,7 +216,16 @@ function SuggestionMention(
225
216
shouldShowSuggestionMenu : false ,
226
217
} ) ) ;
227
218
} ,
228
- [ value , suggestionValues . atSignIndex , suggestionValues . suggestedMentions , suggestionValues . prefixType , getMentionCode , updateComment , setSelection ] ,
219
+ [
220
+ value ,
221
+ suggestionValues . atSignIndex ,
222
+ suggestionValues . suggestedMentions ,
223
+ suggestionValues . prefixType ,
224
+ suggestionValues . mentionPrefix . length ,
225
+ getMentionCode ,
226
+ updateComment ,
227
+ setSelection ,
228
+ ] ,
229
229
) ;
230
230
231
231
/**
0 commit comments