-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update request money header title #29936
Conversation
@fedirjh Could you help to take a look at this PR? Thanks |
@@ -54,6 +54,7 @@ function MoneyRequestParticipantsPage({iou, selectedTab, route}) { | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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
@@ -198,9 +202,11 @@ function MoneyRequestParticipantsSelector({ | |||
]; | |||
} | |||
|
|||
setSelectedParticipants(newSelectedOptions); | |||
|
|||
onAddParticipants(newSelectedOptions); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's avoid these extra steps, let's update onAddParticipants
to accept new parameter instead.
src/libs/actions/IOU.js
Outdated
Onyx.merge(ONYXKEYS.IOU, {participants}); | ||
Onyx.merge(ONYXKEYS.IOU, {isSplitRequest}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Onyx.merge(ONYXKEYS.IOU, {isSplitRequest}); |
Let's use one merge :
Onyx.merge(ONYXKEYS.IOU, {participants, isSplitRequest});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fedirjh Quickly updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @DylanDylann I think there is one more change needed, let's pass an empty array when
iou.isSplitRequest
isfalse
.
@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 = false
whennewSelectedOptions.length === 0
which meansnewSelectedOptions
is empty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DylanDylann Please address this bug, #29936 (comment)
@DylanDylann This change should be applied to this line : App/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js Line 125 in 9df120e
This will fix the issue in #29936 (comment) participants={iou.isSplitRequest ? iou.participants : []} |
@fedirjh Thanks for your suggestion, I updated. Please check again |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
✋ 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 Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.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