Update request money header title#29936
Conversation
|
@fedirjh Could you help to take a look at this PR? Thanks |
| const isScanRequest = MoneyRequestUtils.isScanRequest(selectedTab); | ||
| const isSplitRequest = iou.id === CONST.IOU.MONEY_REQUEST_TYPE.SPLIT; | ||
| const [headerTitle, setHeaderTitle] = useState(); | ||
| const [selectedParticipants, setSelectedParticipants] = useState([]); |
There was a problem hiding this comment.
I think we have a bug with this approach. The bug is that when you refresh the page on the confirmation page, the data is lost for this state check the video.
CleanShot.2023-10-20.at.21.37.45.mp4
There was a problem hiding this comment.
@fedirjh I think this bug occurs because I have not set the default value for state selectedParticipants. I just updated the code, please check again
There was a problem hiding this comment.
@DylanDylann I think passing the default value for the state selectedParticipants will bring back the original bug.
Screen.Recording.2023-10-25.at.11.47.29.AM-converted.mov
|
|
||
| setSelectedParticipants(newSelectedOptions); | ||
|
|
||
| onAddParticipants(newSelectedOptions); |
There was a problem hiding this comment.
I think the best option is to use a new optimistic prop inside the IOU to store the type of the request, something like iou.isSplitRequest and then update it when we select multiple participants, what do you think?
Reviewer Checklist
Screenshots/VideosWebCleanShot.2023-10-27.at.13.45.46.mp4Mobile Web - ChromeCleanShot.2023-10-27.at.13.54.44.mp4Mobile Web - SafariCleanShot.2023-10-27.at.13.52.44.mp4DesktopCleanShot.2023-10-27.at.14.10.57.mp4iOSCleanShot.2023-10-27.at.14.25.42.mp4AndroidCleanShot.2023-10-27.at.16.13.03.mp4 |
|
@DylanDylann Let's split test on 2 separate tests. |
|
@DylanDylann Can we push this forward? |
|
@fedirjh Could you help to check this comment? #29936 (comment) |
|
@DylanDylann setting the default value will bring back the original bug , #29936 (comment) |
|
@fedirjh I am trying your suggestion, i will give some response asap |
|
@fedirjh I just updated code according to your suggestion, please check again |
fedirjh
left a comment
There was a problem hiding this comment.
Let's simplify the code a bit.
src/libs/actions/IOU.js
Outdated
| function setMoneyRequestIsSplitRequest(isSplitRequest) { | ||
| Onyx.merge(ONYXKEYS.IOU, {isSplitRequest}); | ||
| } |
There was a problem hiding this comment.
I think it would be better to update the existing code of setMoneyRequestParticipants instead of creating a new one.
Let's add new parameter to the setMoneyRequestParticipants function.
There was a problem hiding this comment.
@fedirjh Thank you for your comment, please check again
| if (newSelectedOptions.length === 0) { | ||
| IOU.setMoneyRequestIsSplitRequest(false); | ||
| } else { | ||
| IOU.setMoneyRequestIsSplitRequest(true); | ||
| } |
There was a problem hiding this comment.
Let's avoid these extra steps, let's update onAddParticipants to accept new parameter instead.
src/libs/actions/IOU.js
Outdated
| function setMoneyRequestParticipants(participants) { | ||
| function setMoneyRequestParticipants(participants, isSplitRequest) { | ||
| Onyx.merge(ONYXKEYS.IOU, {participants}); | ||
| Onyx.merge(ONYXKEYS.IOU, {isSplitRequest}); |
There was a problem hiding this comment.
| Onyx.merge(ONYXKEYS.IOU, {isSplitRequest}); |
Let's use one merge :
Onyx.merge(ONYXKEYS.IOU, {participants, isSplitRequest});There was a problem hiding this comment.
cc @DylanDylann I think there is one more change needed, let's pass an empty array when iou.isSplitRequest is false.
There was a problem hiding this comment.
I think we have a little bug: when closing the modal without splitting the request, the default type is set to 'split'
bugDesktop.mov
There was a problem hiding this comment.
cc @DylanDylann I think there is one more change needed, let's pass an empty array when
iou.isSplitRequestisfalse.
@fedirjh I think it is unnecessary, currently as code change we have 2 cases iou.isSplitRequest = false
- In function
addSingleParticipant(manual case) we must pass participants param - In function
addParticipantToSelection,isSplitRequest = falsewhennewSelectedOptions.length === 0which meansnewSelectedOptionsis empty
There was a problem hiding this comment.
I think it is unnecessary
@DylanDylann We have this bug, from a manual request, navigating back to the participant's page will display selected user + 'add to split button' in the bottom
CleanShot.2023-10-26.at.12.20.13.mp4
|
@DylanDylann We should reset the |
Thanks for your suggestion, I updated |
fedirjh
left a comment
There was a problem hiding this comment.
@DylanDylann Please address this bug, #29936 (comment)
@DylanDylann This change should be applied to this line : This will fix the issue in #29936 (comment) participants={iou.isSplitRequest ? iou.participants : []} |
|
@fedirjh Thanks for your suggestion, I updated. Please check again |
|
✋ 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/amyevans in version: 1.3.93-0 🚀
|
|
🚀 Deployed to production by https://github.com/Beamanator in version: 1.3.93-1 🚀
|
|
🚀 Deployed to staging by https://github.com/amyevans in version: 1.3.94-0 🚀
|
|
🚀 Deployed to staging by https://github.com/amyevans in version: 1.3.94-0 🚀
|
|
🚀 Deployed to production by https://github.com/Beamanator in version: 1.3.94-2 🚀
|
Details
Fixed Issues
$ #28751
PROPOSAL: #28751 (comment)
Tests
Part 1:
Part 2:
Offline tests
QA Steps
Part 1:
Part 2:
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
Android: Native
android-resize.mov
Android: mWeb Chrome
cr-resize.mov
iOS: Native
ios-resize.mov
iOS: mWeb Safari
sf-resize.mov
MacOS: Chrome / Safari
web-resize.mov
MacOS: Desktop
dk-resize.mov