Skip to content

Commit fe5b3e7

Browse files
committed
Revert "Merge pull request #61362 from Krishna2323/krishna2323/issue/60804"
This reverts commit 228f6b7, reversing changes made to e2d6f3b.
1 parent 00d061c commit fe5b3e7

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/pages/home/report/ReportActionCompose/SuggestionMention.tsx

+13-13
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ function SuggestionMention(
9292
// eslint-disable-next-line react-compiler/react-compiler
9393
suggestionValuesRef.current = suggestionValues;
9494

95-
const [reports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {canBeMissing: false});
95+
const [reports] = useOnyx(ONYXKEYS.COLLECTION.REPORT);
9696

9797
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
9898
const isMentionSuggestionsMenuVisible = !!suggestionValues.suggestedMentions.length && suggestionValues.shouldShowSuggestionMenu;
@@ -190,15 +190,6 @@ function SuggestionMention(
190190
[formatLoginPrivateDomain],
191191
);
192192

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-
202193
/**
203194
* Replace the code of mention and update selection
204195
*/
@@ -210,8 +201,8 @@ function SuggestionMention(
210201
return;
211202
}
212203
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+
215206
updateComment(`${commentBeforeAtSign}${mentionCode} ${trimLeadingSpace(commentAfterMention)}`, true);
216207
const selectionPosition = suggestionValues.atSignIndex + mentionCode.length + CONST.SPACE_LENGTH;
217208
setSelection({
@@ -225,7 +216,16 @@ function SuggestionMention(
225216
shouldShowSuggestionMenu: false,
226217
}));
227218
},
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+
],
229229
);
230230

231231
/**

0 commit comments

Comments
 (0)