fix: Global create emoji is overlapping the message with markdown#77790
Conversation
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
| }, [tnode.attributes, styles, styleProp]); | ||
| }; | ||
|
|
||
| const style = getStyle(); |
There was a problem hiding this comment.
❌ PERF-4 (docs)
Removing useMemo here causes the style array to be recreated on every render, triggering unnecessary re-renders of EmojiWithTooltip even when the actual style values haven't changed.
Fix: Restore the useMemo hook to preserve referential stability:
const style = useMemo(() => {
if ('islarge' in tnode.attributes) {
return [styleProp as TextStyle, styles.onlyEmojisText];
}
if ('ismedium' in tnode.attributes) {
return [styleProp as TextStyle, styles.emojisWithTextFontSize, styles.verticalAlignTopText];
}
return null;
}, [tnode.attributes, styles, styleProp]);| @@ -62,7 +62,7 @@ function TextCommentFragment({fragment, styleAsDeleted, reportActionID, styleAsM | |||
|
|
|||
| const message = isEmpty(iouMessage) ? text : iouMessage; | |||
|
|
|||
There was a problem hiding this comment.
❌ PERF-4 (docs)
Removing useMemo causes processedTextArray to be recalculated on every render, even when message hasn't changed. This creates unnecessary computation overhead.
Fix: Restore the useMemo hook:
const processedTextArray = useMemo(() => splitTextWithEmojis(message), [message]);| // on other device, only render it as text if the only difference is <br /> tag | ||
| const containsOnlyEmojis = containsOnlyEmojisUtil(text ?? ''); | ||
| const containsOnlyCustomEmoji = useMemo(() => containsOnlyCustomEmojiUtil(text), [text]); | ||
| const containsOnlyCustomEmoji = containsOnlyCustomEmojiUtil(text); |
There was a problem hiding this comment.
❌ PERF-4 (docs)
Removing useMemo causes containsOnlyCustomEmoji to be recalculated on every render, even when text hasn't changed. The containsOnlyCustomEmojiUtil function performs string processing that should be memoized.
Fix: Restore the useMemo hook:
const containsOnlyCustomEmoji = useMemo(() => containsOnlyCustomEmojiUtil(text), [text]);| } | ||
|
|
||
| export default memo(TextCommentFragment); | ||
| export default TextCommentFragment; |
There was a problem hiding this comment.
❌ PERF-4 (docs)
Removing memo wrapper from TextCommentFragment component can cause unnecessary re-renders when parent components update, even if this component's props haven't changed. This is particularly important for components used in lists or frequently re-rendered contexts.
Fix: Restore the memo wrapper:
export default memo(TextCommentFragment);
joekaufmanexpensify
left a comment
There was a problem hiding this comment.
Fine from a product perspective
|
@truph01 Updated. Please help to check again. Thanks |
| if ('islarge' in tnode.attributes) { | ||
| style = [styleProp as TextStyle, styles.onlyEmojisText]; | ||
| } | ||
|
|
||
| if ('ismedium' in tnode.attributes) { | ||
| style = [styleProp as TextStyle, styles.emojisWithTextFontSize, styles.verticalAlignTopText]; | ||
| } |
There was a problem hiding this comment.
| if ('islarge' in tnode.attributes) { | |
| style = [styleProp as TextStyle, styles.onlyEmojisText]; | |
| } | |
| if ('ismedium' in tnode.attributes) { | |
| style = [styleProp as TextStyle, styles.emojisWithTextFontSize, styles.verticalAlignTopText]; | |
| } | |
| if ('islarge' in tnode.attributes) { | |
| style = [styleProp as TextStyle, styles.onlyEmojisText]; | |
| } else if ('ismedium' in tnode.attributes) { | |
| style = [styleProp as TextStyle, styles.emojisWithTextFontSize, styles.verticalAlignTopText]; | |
| } else { | |
| style = null; | |
| } |
| @@ -1,24 +1,23 @@ | |||
| import React, {useMemo} from 'react'; | |||
There was a problem hiding this comment.
@paulnjs You shouldn't remove import React here. It will cause a crash app
Reviewer Checklist
Screenshots/VideosiOS: mWeb SafariScreen.Recording.2025-12-29.at.16.00.39.mov |
MariaHCD
left a comment
There was a problem hiding this comment.
Looks good overall, I just have some suggestions around naming!
| import type EmojiWithTooltipProps from './types'; | ||
|
|
||
| function EmojiWithTooltip({emojiCode, style = {}, isMedium = false}: EmojiWithTooltipProps) { | ||
| function EmojiWithTooltip({emojiCode, style = {}, isMedium = false, oneLine = false}: EmojiWithTooltipProps) { |
There was a problem hiding this comment.
| function EmojiWithTooltip({emojiCode, style = {}, isMedium = false, oneLine = false}: EmojiWithTooltipProps) { | |
| function EmojiWithTooltip({emojiCode, style = {}, isMedium = false, isOnSeparateLine = false}: EmojiWithTooltipProps) { |
I think this name would be a bit more clear
| return privateUseAreaRegex.test(text); | ||
| } | ||
|
|
||
| function isSingleEmojiLine(line: string) { |
There was a problem hiding this comment.
| function isSingleEmojiLine(line: string) { | |
| function isEmojiOnSeparateLine(line: string) { |
Here as well - I think this name would be a bit more clearer
|
@MariaHCD I updated. Please help to check again. Thank you! |
|
✋ 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/MariaHCD in version: 9.2.89-1 🚀
|
|
🚀 Deployed to production by https://github.com/thienlnam in version: 9.2.89-6 🚀
|




Explanation of Change
Fixed Issues
$#76899
PROPOSAL:#76899 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari