-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix: ComposeBox - When you click on the mention again, extra characters appear. #61362
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
Conversation
…rs appear. Signed-off-by: krishna2323 <[email protected]>
Signed-off-by: krishna2323 <[email protected]>
@hoangzinh Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2025-05-12.at.20.15.57.android.movAndroid: mWeb ChromeScreen.Recording.2025-05-12.at.17.27.39.android.chrome.moviOS: HybridAppScreen.Recording.2025-05-12.at.20.27.08.moviOS: mWeb SafariScreen.Recording.2025-05-12.at.20.06.13.ios.safari.movMacOS: Chrome / SafariScreen.Recording.2025-05-12.at.17.18.51.web.movMacOS: DesktopScreen.Recording.2025-05-12.at.17.23.28.desktop.mov |
@@ -190,6 +190,12 @@ function SuggestionMention( | |||
[formatLoginPrivateDomain], | |||
); | |||
|
|||
function getOriginalMentionText(inputValue: string, atSignIndex: number) { | |||
const rest = inputValue.slice(atSignIndex); | |||
const mentionMatch = rest.match(/^[@\w.\-+]+/); // capture till space or special characters not in emails |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Krishna2323 won't we use MENTION_BREAKER as you mentioned in your proposal? If not can you put this new regrex into a const?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, my mistake — I've updated it to use MENTION_BREAKER.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Krishna2323. Can you elaborate on why we need to use both .search
and .match
for MENTION_BREAKER? It look like MENTION_BREAKER
is not used anywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hoangzinh, I got this solution from AI, and after prompting again, I received the following clarification and updated the code accordingly. I’ve tested the solution as well:
You don’t need both — .search() is sufficient to locate the first breaking character (space, emoji, etc.).
If .match() is also used, it's likely unnecessary unless you want to inspect the actual matched breakers.
In clean implementation, use only .search() with MENTION_BREAKER.
Signed-off-by: krishna2323 <[email protected]>
@Krishna2323, can you help to merge the latest main to this PR? |
updateComment, | ||
setSelection, | ||
], | ||
[value, suggestionValues.atSignIndex, suggestionValues.suggestedMentions, suggestionValues.prefixType, getMentionCode, updateComment, setSelection], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it have a lint issue if we use previous style? I prefer spread in multiple line as previously, it makes code cleaner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so, because printWidth
is set to 190 and this line only includes 157 characters.
Line 7 in 81b1b49
printWidth: 190, |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/dangrous in version: 9.1.45-0 🚀
|
🚀 Deployed to staging by https://github.com/dangrous in version: 9.1.45-0 🚀
|
Failing on iOS with original bug #60804 |
@Krishna2323 @hoangzinh can you follow up on that? |
🚀 Deployed to production by https://github.com/francoisl in version: 9.1.45-21 🚀
|
PR was reverted, thus we need to create another one to fix original issue (and DB) |
I'll raise the new PR soon. |
Explanation of Change
Fixed Issues
$ #60804
PROPOSAL: #60804 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
android_native.mp4
Android: mWeb Chrome
android_chrome.mp4
iOS: Native
ios_native.mp4
iOS: mWeb Safari
ios_safari.mp4
MacOS: Chrome / Safari
web_chrome.mp4
MacOS: Desktop
desktop_app.mp4