Skin tone fix#16604
Conversation
|
@PauloGasparSv 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] |
|
Hey @perunt, I see you linked the GH issue like this That's important so the original issue's team members are assigned to the P.R. and so the issue is updated correctly when the P.R. is merged Let me fix that for you and assign @mountiny here! |
|
Hey, just a suggestion, You could use the let emojiReplacement = getEmojiCodeWithSkinColor(checkEmoji.metaData, preferredSkinTone); |
|
Also, the current code causes a crash when we try to edit a message. Screen.Recording.2023-03-28.at.4.55.40.PM-1.movNote: The comment above does not fix this crash, that was just an alternative way of dealing with the skinTone |
mountiny
left a comment
There was a problem hiding this comment.
Thank you @PauloGasparSv for the headstart and @esh-g for the tips!
Assigned @s77rt for testing and review
@perunt thanks for working on this so quickly, could you also please add videos on all the platforms? Thank you 🙇
|
I also found a way to fix the crash! |
|
@esh-g What crash is this supposed to fix? |
|
It is currently crashing because we are focusing on the textInput here: App/src/pages/home/report/ReportActionItem.js Line 106 in 3f66c68 But this.textInput is undefined as the ref is not yet ready due to onyx. Similar to this issue: #15296 (comment)
|
Yes, as we immediately focusing the textinput for edit message and onyx fetch won't allow to render the child immediately which will throw the undefined ref issue. |
|
Okay, Just needed to add the condition to update the component on change to shouldComponentUpdate(nextProps, nextState) {
return this.props.displayAsGroup !== nextProps.displayAsGroup
|| this.props.draftMessage !== nextProps.draftMessage
|| this.props.isMostRecentIOUReportAction !== nextProps.isMostRecentIOUReportAction
|| this.props.hasOutstandingIOU !== nextProps.hasOutstandingIOU
|| this.props.shouldDisplayNewMarker !== nextProps.shouldDisplayNewMarker
|| !_.isEqual(this.props.action, nextProps.action)
|| this.state.isContextMenuActive !== nextState.isContextMenuActive
+ || this.props.preferredSkinTone !== nextProps.preferredSkinTone;
}
``` |
|
Here is a summary of the changes I am suggesting:
These changes will prevent the crash and also preserve the intended functionality. Screen.Recording.2023-03-28.at.6.59.45.PM-1.mov |
|
Setting |
|
@s77rt Have you also added the condition in |
|
@esh-g Yes. no effect. As an alternative solution maybe we should pass Although this solution works well |
|
We can consolidate |
|
@perunt I really don't see why would we merge those files into one. Isn't this achieving the same results of the proposed alternative solution above ^ |
|
In this case, only the Message component would be re-rendered upon modifying the skin tone, while the |
Reviewer Checklist
Screenshots/VideosWebweb.mp4Mobile Web - Chromemweb-chrome.mp4Mobile Web - Safarimweb-safari.mp4Desktopdesktop.mp4iOSios.mp4Androidandroid.mp4 |
|
@s77rt can you do a final tests/check and approve the PR if all is good please? |
mountiny
left a comment
There was a problem hiding this comment.
Lets do this then, thanks everyone!
|
✋ 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/mountiny in version: 1.2.94-0 🚀
|
| const checkEmoji = emojisTrie.search(emojiData[i].slice(1, -1)); | ||
| if (checkEmoji && checkEmoji.metaData.code) { | ||
| let emojiReplacement = checkEmoji.metaData.code; | ||
| let emojiReplacement = this.getEmojiCodeWithSkinColor(checkEmoji.metaData, preferredSkinTone); |
There was a problem hiding this comment.
This line caused this regression #16896 , We should remove the this. keyword and simply call the getEmojiCodeWithSkinColor() function directly.
There was a problem hiding this comment.
How come I was not able to reproduce this on localhost? Is this caused by the diff between debug javascript files and the built ones?
There was a problem hiding this comment.
this keyword refer to the module EmojiUtils, on dev environment variables and function names are preserved , When code is minified during production, function and variable names are often changed to shorter, more efficient names. This can cause issues if you are using this to access functions or entities, as the new names may not match the original names.
| Dev | Same module on production |
|---|---|
![]() |
![]() |
There was a problem hiding this comment.
Good find, and that's quite interesting about this. working on Dev but not production 🤔 Maybe we need some better eslint rules to catch this in the future?
There was a problem hiding this comment.
@Beamanator That would be good. Can you please create a tracking issue for this one? The lint rule is good approach to prevent this bug but what about other unknown diff between dev and built js files?
|
🚀 Deployed to production by https://github.com/thienlnam in version: 1.2.94-3 🚀
|



Details
Fixed Issues
$ #15805
PROPOSAL: GH_LINK_ISSUE(COMMENT)
Tests
:+1:in the text input field.:+1:in the text input field again.Repeat the same steps for the message edit input field.
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionQA stepssectiontoggleReportand notonIconClick).src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarhave been tested & I retested again)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)Avataris modified, I verified thatAvataris working as expected in all cases)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
Web
Mar-28-2023.10-02-32.mp4
Apr-03-2023.11-35-46.mp4
Mobile Web - Chrome
Mobile Web - Safari
Desktop
Uploading Apr-03-2023 11-45-17.mp4…
iOS
Uploading Apr-03-2023 11-42-58.mp4…
Android
Apr-03-2023.11-40-43.mp4