Group chat: Use draft only on init and on draft changes#39312
Group chat: Use draft only on init and on draft changes#39312marcaaron merged 1 commit intoExpensify:mainfrom
Conversation
| useEffect(() => { | ||
| setSelectedOptions(getGroupParticipants()); | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps -- Overwrite participants only if the draft changes | ||
| }, [newGroupDraft?.participants]); |
There was a problem hiding this comment.
This may raise the question on why we don't always use the draft participants i.e. selectedOptions = newGroupDraft.participants. The reason is that the draft participants are set only after the user presses the next button.
There was a problem hiding this comment.
Great point. Makes me wonder why we don't start saving them when you first tap "Add to group". Feels like we should have designed it that way (fixing that seems outside the scope of your current changes). 🤔
|
I have only added videos for Web. Let me know if I need to include the rest |
|
@c3024 I don't think this needs a C+ review |
|
cc @marcaaron |
marcaaron
left a comment
There was a problem hiding this comment.
Code LGTM! I will have to run through testing if we don't add a C+. No problem for me, but have a few things to get to first. Will try to merge this by EOD.
| useEffect(() => { | ||
| setSelectedOptions(getGroupParticipants()); | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps -- Overwrite participants only if the draft changes | ||
| }, [newGroupDraft?.participants]); |
There was a problem hiding this comment.
Great point. Makes me wonder why we don't start saving them when you first tap "Add to group". Feels like we should have designed it that way (fixing that seems outside the scope of your current changes). 🤔
Reviewer Checklist
Screenshots/Videos |
marcaaron
left a comment
There was a problem hiding this comment.
Tests well and LGTM. Thanks for the change!
|
✋ 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 production by https://github.com/Julesssss in version: 1.4.60-13 🚀
|






Details
The chat selected participants were being overwritten by the draft values whenever the options changes. This PR makes the draft used only at first render (initialization) and when the draft changes e.g. when a user is removed in the confirmation page.
Fixed Issues
$ #39295
Tests
Test 1
Test 2
Offline tests
Same as Tests
QA Steps
Same as Tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))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
web.1.mov
web.2.mov
MacOS: Desktop