Fix send button is enabled when composer contains only space#26851
Conversation
| isCommentEmpty: { | ||
| key: ({reportID}) => `${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${reportID}`, | ||
| selector: (comment) => _.isEmpty(comment), | ||
| }, |
There was a problem hiding this comment.
I modified the solution a little bit because I found an issue with the onyx selector.
When the draft comment onyx is updated, the selector is triggered twice with different values.
First, the value will be boolean (wrong) and the second one will be the comment itself (correct).
The boolean value is based on what we return on the selector. For example, if the comment is empty, the selector will be triggered with true and the comment value.
As the above isCommentEmpty prop is only used to initialize the isCommentEmpty state, I use a lazy init for the state which takes the draft comment with getDraftComment. We did the same pattern here too:
|
I ran the reassure test locally and no timeout issue. I think the problem is in the ci |
Reviewer Checklist
Screenshots/VideosWebCleanShot.2023-09-06.at.09.36.06.mp4Mobile Web - ChromeCleanShot.2023-09-06.at.10.04.29.mp4Mobile Web - SafariCleanShot.2023-09-06.at.09.44.59.mp4DesktopCleanShot.2023-09-06.at.09.51.35.mp4iOSCleanShot.2023-09-06.at.09.58.51.mp4AndroidCleanShot.2023-09-06.at.10.27.19.mp4 |
fedirjh
left a comment
There was a problem hiding this comment.
The code looks good and it tests well.
🎀 👀 🎀 C+ reviewed
|
cc @aldo-expensify Can you please re-trigger the reassure tests, It passes locally. |
|
cc @aldo-expensify This is ready to get merged. |
|
Thanks, I'm going to wait until after the next deploy, we already have a huge number of PRs that are coming in the next deploy. |
|
@aldo-expensify I think we can merge this one |
|
Thanks for the ping! |
|
✋ 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/aldo-expensify in version: 1.3.74-0 🚀
|
|
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.3.74-3 🚀
|
Details
The composer send button is enabled even when the text contains only space.
Fixed Issues
$ #26433
PROPOSAL: #26433 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.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 usingAvatarare working as expected)/** 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
Screen.Recording.2023-09-06.at.13.36.44.mov
Mobile Web - Chrome
Screen.Recording.2023-09-06.at.13.20.06.mov
Mobile Web - Safari
Screen.Recording.2023-09-06.at.13.18.48.mov
Desktop
Screen.Recording.2023-09-06.at.13.17.58.mov
iOS
Screen.Recording.2023-09-06.at.13.36.19.mov
Android
Screen.Recording.2023-09-06.at.13.22.32.mov