-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[$250] ComposeBox - When you click on the mention again, extra characters appear #60804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Triggered auto assignment to @lydiabarclay ( |
🚨 Edited by proposal-police: This proposal was edited at 2025-04-29 20:36:16 UTC. ProposalPlease re-state the problem that we are trying to solve in this issue.
What is the root cause of that problem?
App/src/pages/home/report/ReportActionCompose/SuggestionMention.tsx Lines 196 to 218 in d629de0
What changes do you think we should make in order to solve the problem?
Code diff+ function getOriginalMentionText(valuee: string, atSignIndex: number) {
+ const rest = valuee.slice(atSignIndex);
+ const mentionMatch = rest.match(/^[@\w.\-+]+/); // capture till space or special characters not in emails
+ return mentionMatch?.[0] ?? '';
+ }
const insertSelectedMention = useCallback(
(highlightedMentionIndexInner: number) => {
const commentBeforeAtSign = value.slice(0, suggestionValues.atSignIndex);
const mentionObject = suggestionValues.suggestedMentions.at(highlightedMentionIndexInner);
if (!mentionObject || highlightedMentionIndexInner === -1) {
return;
}
const mentionCode = getMentionCode(mentionObject, suggestionValues.prefixType);
- const commentAfterMention = value.slice(suggestionValues.atSignIndex + suggestionValues.mentionPrefix.length + 1);
+ const originalMention = getOriginalMentionText(value, suggestionValues.atSignIndex);
+ const commentAfterMention = value.slice(suggestionValues.atSignIndex + originalMention.length);
updateComment(`${commentBeforeAtSign}${mentionCode} ${trimLeadingSpace(commentAfterMention)}`, true);
const selectionPosition = suggestionValues.atSignIndex + mentionCode.length + CONST.SPACE_LENGTH;
setSelection({
start: selectionPosition,
end: selectionPosition,
});
suggestionInsertionIndexRef.current = selectionPosition;
setSuggestionValues((prevState) => ({
...prevState,
suggestedMentions: [],
shouldShowSuggestionMenu: false,
}));
},
- [
- value,
- suggestionValues.atSignIndex,
- suggestionValues.suggestedMentions,
- suggestionValues.prefixType,
- suggestionValues.mentionPrefix.length,
- getMentionCode,
- updateComment,
- setSelection,
- ],
+ [
+ value,
+ suggestionValues.atSignIndex,
+ suggestionValues.suggestedMentions,
+ suggestionValues.prefixType,
+ getMentionCode,
+ updateComment,
+ setSelection,
+ ],
); What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
What alternative solutions did you explore? (Optional)N/A Result |
Job added to Upwork: https://www.upwork.com/jobs/~021915530953266836404 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @hoangzinh ( |
@Krishna2323 can you check if we have any existing regrex for this |
@hoangzinh, I think we can use Lines 3494 to 3498 in 3885a40
Monosnap.screencast.2025-04-28.15-15-20.mp4 |
Cool. Can you add it to your proposal? Also, you can put code diff into |
Can help with internal review on this when it's ready for it! |
|
Thank you. @Krishna2323's proposal looks good to me. Link to proposal #60804 (comment) 🎀👀🎀 C+ reviewed |
Current assignee @dangrous is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new. |
📣 @Krishna2323 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
@hoangzinh, PR is ready for review ^ |
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results. If a regression has occurred and you are the assigned CM follow the instructions here. If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future. |
@hoangzinh looks like a different issue was the cause of the above deploy blocker, could you confirm? |
yes, the PR was reverted. @Krishna2323 can you create another PR to fix this issue again? |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.1.32-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: No, reproducible on hybrid only
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/5995329
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team
Device used: Macbook/13.7.5/Chrome, OnePlus 9 PRO/Android 14/Chrome, iPhone 12 PRO/iOS 18.4.1
App Component: Chat Report View
Action Performed:
Expected Result:
When you click on the mention again, nothing should change
Actual Result:
When you click on a mention again, extra characters appear at the end of the mention.
Workaround:
Unknown
Platforms:
Screenshots/Videos
1.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @Issue Owner
Current Issue Owner: @Krishna2323The text was updated successfully, but these errors were encountered: