-
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
[CP Staging] Fix: Expense - App crashes when changing date, description, merchant of the request #36919
Conversation
@rushatgabhane 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] |
src/libs/actions/IOU.ts
Outdated
@@ -1140,7 +1140,8 @@ function getUpdateMoneyRequestParams( | |||
? IOUUtils.updateIOUOwnerAndTotal(iouReport, updatedReportAction.actorAccountID ?? -1, diff, TransactionUtils.getCurrency(transaction), false, true) | |||
: {}; | |||
} | |||
updatedMoneyRequestReport.cachedTotal = CurrencyUtils.convertToDisplayString(updatedMoneyRequestReport.total, updatedTransaction?.modifiedCurrency); | |||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing | |||
updatedMoneyRequestReport.cachedTotal = CurrencyUtils.convertToDisplayString(updatedMoneyRequestReport.total, updatedTransaction?.modifiedCurrency || updatedTransaction?.currency); |
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 really need the fallback? It looks like updatedTransaction.modifiedCurrency
gets set to the same value as updatedTransaction.currency
in getUpdatedTransaction
, so wouldn't it be the same if this was
updatedMoneyRequestReport.cachedTotal = CurrencyUtils.convertToDisplayString(updatedMoneyRequestReport.total, updatedTransaction?.currency);
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
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.
In getUpdatedTransaction
, modifiedCurrency
gets set from the transactionChanges
whereas the original transaction currency
remains the old value only.
We can use transactionDetails.currency
also as it is doing the same thing.
Lines 1051 to 1052 in 12fc2cb
let updatedTransaction = transaction ? TransactionUtils.getUpdatedTransaction(transaction, transactionChanges, isFromExpenseReport) : null; | |
const transactionDetails = ReportUtils.getTransactionDetails(updatedTransaction); |
App/src/libs/TransactionUtils.ts
Lines 291 to 297 in 299576f
function getCurrency(transaction: OnyxEntry<Transaction>): string { | |
const currency = transaction?.modifiedCurrency ?? ''; | |
if (currency) { | |
return currency; | |
} | |
return transaction?.currency ?? CONST.CURRENCY.USD; | |
} |
Reviewer Checklist
Screenshots/VideosScreen.Recording.2024-02-20.at.19.00.10.mp4Android: NativeAndroid: mWeb ChromeiOS: NativeiOS: mWeb SafariMacOS: Chrome / SafariMacOS: Desktop |
Works well! I could see some console errors but I think those were related to my specific account and not to this PR |
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.
Thanks, this is safer
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
[CP Staging] Fix: Expense - App crashes when changing date, description, merchant of the request (cherry picked from commit b98ebd4)
Manually posting since the automated one failed The code for this has been CP-d to staging and should be testable in version: 1.4.43-8 🚀 @Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
🚀 Deployed to production by https://github.com/puneetlath in version: 1.4.43-20 🚀
|
Details
#36857
Fixed Issues
$ #36857
PROPOSAL: #36857 (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
p1.mp4
Mobile Web - Chrome
p2.mp4
Mobile Web - Safari
Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-02-20.at.21.34.36.mp4
Desktop
Screen.Recording.2024-02-20.at.21.39.43.mov
iOS
Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-02-20.at.21.32.21.mp4
Android