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] |
| onSendMoney(paymentMethod); | ||
| } else { | ||
| onConfirm(selectedParticipants); | ||
| onConfirm(selectedParticipants, distanceMerchant); |
There was a problem hiding this comment.
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.
Let me check that too 👍
There was a problem hiding this comment.
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.
Is this a typo? It should be props.iou.merchant?
There was a problem hiding this comment.
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], |
@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! |
| 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.
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 👍
|
✋ 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.
Do we still need this change ?
There was a problem hiding this comment.
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 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
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