-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fix - Distance Request Optimistic Data (26518) #26536
Conversation
@Santhosh-Sellavel 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] |
@@ -337,10 +339,10 @@ function MoneyRequestConfirmationList(props) { | |||
Log.info(`[IOU] Sending money via: ${paymentMethod}`); | |||
onSendMoney(paymentMethod); | |||
} else { | |||
onConfirm(selectedParticipants); | |||
onConfirm(selectedParticipants, distanceMerchant); |
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 don't like this approach of passing the merchant to the onConfirm
method. Why can't we set it like we're setting the amount here?
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 me check that too 👍
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.
Updated code for this to use the existing IOU.setMoneyRequestMerchant
.
ops don't merge I accidentally approved 😨 |
@hayata-suenaga Here |
which reportID is compared to which reportID. What are data sources being compared? |
Report ID of IOU and the report id available in transactions. |
@hayata-suenaga can you suggest me a faster way to build android ? |
@jeet-dhandha can you actually make sure that reportID on the transaction is stored as a number? |
Let me try test build. Are you on beta for the distance request feature? |
@jeet-dhandha test build in process here... by the way, thank you for sticking with us. I know it's late over there |
props.iou.transactionID, | ||
props.iou.amount, | ||
props.iou.currency, | ||
props.iou.merchat, |
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.
Is this a typo? It should be props.iou.merchant
?
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.
Yes 🙇 . Sorry for that.
}, | ||
[props.report, props.iou.created, props.iou.transactionID], | ||
[props.report, props.iou.created, props.iou.transactionID, props.iou.amount, props.iou.currency, props.iou.merchat], |
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.
Same here.
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.
Slip of hand 🥲
@jeet-dhandha thank you for the screenshot. I can see that reportID is stored as a string. Are these transactions that has reportID as a string all coming from the distance request or are they generally stored as a string? |
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-09-02.at.2.01.41.PM.movMobile Web - ChromeScreen.Recording.2023-09-02.at.2.09.15.PM.movMobile Web - SafariScreen.Recording.2023-09-02.at.2.07.03.PM.movDesktopScreen.Recording.2023-09-02.at.2.04.58.PM.moviOSScreen.Recording.2023-09-02.at.2.07.58.PM.movAndroidScreen.Recording.2023-09-02.at.2.10.11.PM.mov |
@hayata-suenaga This should be handled in back-end so should i remove the code i did in |
I have updated videos and code please check and get back. |
@jeet-dhandha I will fix the backend to return reportID as a string, but it won't be deployed for a while. So please leave the handling to turn it into a string and a comment explaining that we will fix it on the backend. I will create a follow up issue. |
Added comment |
@hayata-suenaga Is this expected or is it a bug? |
Distance requests use the workspace default rate. When you change the workspace currency under workspace settings it changes the currency in the rate. We want to use the currency in the rate. If the rate is 0.625 USD and you change the currency to PKR we don't convert the rate, it's correctly 0.625 PKR. |
@allroundexperts Please ping if anything needed. |
@allroundexperts please proceed with the rest of the checklist 🙇 |
On it! |
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!
const distanceMerchant = useMemo(() => DistanceRequestUtils.getDistanceMerchant(distance, unit, rate, currency, translate), [distance, unit, rate, currency, translate]); | ||
|
||
useEffect(() => { | ||
IOU.setMoneyRequestMerchant(distanceMerchant); |
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 don't like this pattern though.
We should get the distance request merchant string and set the string in IOU at the same place.
We can put the following code inside useEffect
with the dependency array.
const distanceMerchant = DistanceRequestUtils.getDistanceMerchant(distance, unit, rate, currency, translate)
IOU.setMoneyRequestMerchant(distanceMerchant);
And for the title
of MenuItemWithTopDescription
, we can pass iou.merchant
instead.
I gonna approve this PR right now, but please make a follow up PR @jeet-dhandha for the cleanup 🙇
We consider the issue to be complete after the follow-up PR is merged 👍
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.
@hayata-suenaga Okay.
✋ 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/hayata-suenaga in version: 1.3.63-0 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.3.63-2 🚀
|
🚀 Deployed to staging by https://github.com/hayata-suenaga in version: 1.3.64-0 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.3.64-2 🚀
|
// `reportID` from the `/CreateDistanceRequest` endpoint return's number instead of string for created `transaction`. | ||
// For reference, https://github.com/Expensify/App/pull/26536#issuecomment-1703573277. | ||
// We will update this in a follow-up Issue. According to this comment: https://github.com/Expensify/App/pull/26536#issuecomment-1703591019. | ||
return _.filter(allTransactions, (transaction) => `${transaction.reportID}` === `${reportID}`); |
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.
Do we still need this change ?
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.
You can test it out and see. Hopefully it has been fixed.
Details
Fixed Issues
$ #26518
PROPOSAL: #26518 (comment)
Tests
Offline tests
QA Steps
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
Web
DistanceRequset-OptimisticData-WEb.mp4
Mobile Web - Chrome
DistanceRequset-OptimisticData-Mobile-Chrome.mp4
Mobile Web - Safari
DistanceRequset-OptimisticData-Mobile-Safari.mp4
Desktop
DistanceRequset-OptimisticData-Desktop.mp4
iOS
DistanceRequset-OptimisticData-iOS.mp4
Android
DistanceRequset-OptimisticData-Android.mp4