Fixed currency selection on confirm step#34075
Conversation
Screen.Recording.2024-01-06.at.9.37.59.PM.mov@hoangzinh There's a slight delay in updating the currency. Is that fine as we are changing currency on unmount only? |
|
@shubham1206agra I recall there is related issue here https://expensify.slack.com/archives/C01GTK53T8Q/p1704368050838699 |
This will not be fixed by that. I am proposing to use a spinner while old value is present. |
|
ah I just want to share that "There's a slight delay in updating the currency" might cause an issue later. I think using a spinner is work around and it will cause bad UX when user see a spinner in a short time |
Can you suggest me what should we do in this case? |
|
@shubham1206agra sorry I was thinking about what should we do so I'm late. Wdyt about the approach here https://expensify.slack.com/archives/C01GTK53T8Q/p1704818739022579 Wait onyx updated then goBack 🤔 |
To be honest, this looks like a bad idea to just simply wait as it might look laggy to the user. I think its safe to use spinner (I know it will be a short spinner), rather than simply wait, which is actually an anti-pattern in the code. What is your opinion on this @tgolen? |
Agreed. I'm okay with Spinner. Just wanna confirm, is it a full loading screen? |
Right now, I am thinking spinner on amount only. But I think, full screen spinner would be better. |
|
@hoangzinh 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] |
|
@shubham1206agra thanks for updates, I will try to do code review within 2 days. |
| IOU.setMoneyRequestBillable_temporaryForRefactor(transactionID, billable); | ||
| }; | ||
|
|
||
| const isLoading = !!(transaction && transaction.originalCurrency); |
There was a problem hiding this comment.
I think we need to leave comment here to explain why we have this code
There was a problem hiding this comment.
@shubham1206agra could you help to leave a comment here, other than that it looks good to me.
| IOU.setMoneyRequestCurrency_temporaryForRefactor(transactionID, originalCurrency.current, true); | ||
| }; | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| }, []); |
There was a problem hiding this comment.
I'm thinking is it possible if we don't need an additional useRef and modify current IOU.setMoneyRequestOriginalCurrency_temporaryForRefactor to pass a 3rd params like current implementation.
How about?
useEffect(() => {
IOU.setMoneyRequestOriginalCurrency_temporaryForRefactor(transactionID, currency);
return () => {
if (isSaveButtonPressed.current) {
return;
}
IOU.setMoneyRequestCurrency_temporaryForRefactor(transactionID, transaction.originalCurrency);
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);There was a problem hiding this comment.
Actually, it was creating some problems as it was keeping old values in mount / unmount.
There was a problem hiding this comment.
Or we can always reset originalCurrency on unmount.
There was a problem hiding this comment.
Let keep it this way as it helps me with cases of refresh (it will call mount again, and will set wrong value on refresh).
There was a problem hiding this comment.
Hi @shubham1206agra I will try to test & complete review checklist tomorrow
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-02-03.at.20.14.52.android.movAndroid: mWeb ChromeScreen.Recording.2024-02-03.at.19.45.36.android.chrome.moviOS: NativeScreen.Recording.2024-02-03.at.19.50.10.ios.moviOS: mWeb SafariScreen.Recording.2024-02-03.at.19.47.36.ios.safari.movMacOS: Chrome / SafariScreen.Recording.2024-02-03.at.19.41.52.web.movMacOS: DesktopScreen.Recording.2024-02-03.at.19.43.43.desktop.mov |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Cherry-picked to staging by https://github.com/thienlnam in version: 1.4.36-5 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
1 similar comment
|
🚀 Cherry-picked to staging by https://github.com/thienlnam in version: 1.4.36-5 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
|
🚀 Deployed to production by https://github.com/Julesssss in version: 1.4.37-7 🚀
|
|
This regression is caused by changes introduced in this PR. |
Details
Fixed Issues
$ #33608
PROPOSAL: #33608 (comment)
Tests
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 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)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel so 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
Screen.Recording.2024-01-22.at.6.58.11.PM.mov
Android: mWeb Chrome
Screen.Recording.2024-01-22.at.5.14.11.PM.mov
iOS: Native
Screen.Recording.2024-01-22.at.6.44.34.PM.mov
iOS: mWeb Safari
Screen.Recording.2024-01-22.at.5.10.29.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2024-01-22.at.5.07.19.PM.mov
MacOS: Desktop
Screen.Recording.2024-01-22.at.6.37.29.PM.mov