[$250] Expense - Amount in expense preview does not match the edited amount in deleted workspace
If you havenβt already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.0.65-1 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/5250638 Email or phone of affected tester (no customers): [email protected] Logs: https://stackoverflow.com/c/expensify/questions/4856 Issue reported by: Applause-Internal team
Action Performed:
- Go to staging.new.expensify.com
- Create a new workspace.
- Go to workspace chat.
- Submit an expense.
- Delete the workspace.
- Go back to the workspace chat.
- Click on the expense preview.
- Click Amount.
- Edit the amount and save it.
- Go back to the main workspace chat.
Expected Result:
The amount in the expense preview in the main chat will match the edited amount.
Actual Result:
The amount in the expense preview in the main chat does not match the edited amount. This issue only happens when the workspace is deleted.
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
- [x] Android: Standalone
- [x] Android: HybridApp
- [x] Android: mWeb Chrome
- [x] iOS: Standalone
- [x] iOS: HybridApp
- [x] iOS: mWeb Safari
- [x] MacOS: Chrome / Safari
- [x] MacOS: Desktop
Screenshots/Videos
https://github.com/user-attachments/assets/34996898-d9a6-4bff-839e-17bc988d767f
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~021860113886210272641
- Upwork Job ID: 1860113886210272641
- Last Price Increase: 2024-12-07
Issue Owner
Current Issue Owner: @aldo-expensify
Triggered auto assignment to @MitchExpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Amount in expense preview does not match the edited amount in deleted workspace
What is the root cause of that problem?
This is a backend issue. I say that because the total in the response is incorrect, so we display it incorrectly
What changes do you think we should make in order to solve the problem?
I think, in this case, I must disable expenses to prevent updates when the workspace is archived, to avoid calculating the wrong value and incorrect logic. Some thing like this:
// src/components/ReportActionItem/MoneyRequestView.tsx#L438
+ const isArchivedRoom = ReportUtils.isArchivedRoomWithID(parentReport?.chatReportID);
// src/components/ReportActionItem/MoneyRequestView.tsx#L514
<MenuItemWithTopDescription
title={amountTitle}
shouldShowTitleIcon={isSettled}
titleIcon={Expensicons.Checkmark}
description={amountDescription}
titleStyle={styles.textHeadlineH2}
interactive={canEditAmount}
shouldShowRightIcon={canEditAmount}
onPress={() =>
Navigation.navigate(
ROUTES.MONEY_REQUEST_STEP_AMOUNT.getRoute(
CONST.IOU.ACTION.EDIT,
iouType,
transaction?.transactionID ?? '-1',
report?.reportID ?? '-1',
'',
Navigation.getReportRHPActiveRoute(),
),
)
}
brickRoadIndicator={getErrorForField('amount') ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined}
errorText={getErrorForField('amount')}
+ disabled={isArchivedRoom}
/>
We will do it like this for the description, date, and so on, if needed.
POC
What alternative solutions did you explore? (Optional)
Job added to Upwork: https://www.upwork.com/jobs/~021860113886210272641
Triggered auto assignment to Contributor-plus team member for initial proposal review - @rojiphil (External)
Proposal
Please re-state the problem that we are trying to solve in this issue.
The amount in the expense preview in the main chat does not match the edited amount. This issue only happens when the workspace is deleted.
What is the root cause of that problem?
We're not disabling edit the money request when the workspace is deleted.
What changes do you think we should make in order to solve the problem?
We should return false if the chat report is archived or the policy doesn't exist
if (!policy || isArchivedRoom(chatReport)) {
return false;
}
https://github.com/Expensify/App/blob/51e25af3df2eef49c2ac87e0aef816099f9d3747/src/libs/ReportUtils.ts#L3133
What alternative solutions did you explore? (Optional)
NA
Expenses should remain editable even if the workspace is deleted https://github.com/Expensify/App/issues/51164#issuecomment-2429193154. This is a BE bug @MitchExpensify.
Expenses should remain editable even if the workspace is deleted #51164 (comment).
Thanks @CyberAndrii for the context. This then looks like a BE issue. Let us also bring the internal engineer to weigh in here and conclude on the way ahead. πππ
Triggered auto assignment to @aldo-expensify, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
Asking here to confirm the expected behaviour: https://github.com/Expensify/App/issues/51164#issuecomment-2502535625 . Just in case we made that decision to avoid having to work on something we don't care. Now we will have to work in the backend to fix the inconsistency and I would prefer to shift this work to the frontend if we really don't care about the expected behaviour.
Ok, seems like the expected behaviour is correct here, so I'll investigate why the backend is not modifying the data then.
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
Can't reproduce in main:
https://github.com/user-attachments/assets/40426195-6876-41b1-b46a-4869c58b6b7c
Going to try staging...
In staging I see some currency conversion bug: The amount gets converted to the amount in USD, but it still says CA$:
https://github.com/user-attachments/assets/7074028c-3dcd-4bd2-9e36-c1e26832ded5
The transaction comes from the backend with the right modifiedAmount: -2500, but the reportAction preview has a value that looks off:
{
"childCanHold": true,
"childCanUnhold": false,
"childCommenterCount": 0,
"childLastActorAccountID": 18775088,
"childLastMoneyRequestComment": "",
"childLastReceiptTransactionIDs": "",
"childLastVisibleActionCreated": "",
"childManagerAccountID": 18775088,
"childMoneyRequestCount": 1,
"childOldestFourAccountIDs": "",
"childOwnerAccountID": 18775088,
"childRecentReceiptTransactionIDs": [],
"childReportID": 7008012655928011,
"childReportName": "Expense Report #7008012655928011",
"childReportNotificationPreference": "hidden",
"childStateNum": 1,
"childStatusNum": 1,
"childType": "expense",
"childVisibleActionCount": 0,
"message": [
{
"html": " owes C$32.11",
"text": " owes C$32.11",
"type": "COMMENT",
"whisperedTo": []
}
],
"originalMessage": {
"isNewDot": true,
"lastModified": "2024-12-03 02:17:07.709",
"linkedReportID": "7008012655928011"
}
}
hmm, I'm not able to reproduce the currency issue that I saw in staging: https://github.com/Expensify/App/issues/52896#issuecomment-2513403728 in dev
@izarutskaya can you check if this issue is still reproducible? π
@rojiphil @MitchExpensify @aldo-expensify this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
@rojiphil, @MitchExpensify, @aldo-expensify Whoops! This issue is 2 days overdue. Let's get this updated quick!
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989
Adding Needs Reproduction since I'm failing to reproduce
Unassigning myself as I donβt think there is anything to be done in FE. But will stay subscribed though. Thanks.
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
@MitchExpensify, @aldo-expensify Whoops! This issue is 2 days overdue. Let's get this updated quick!
@MitchExpensify, @aldo-expensify Huh... This is 4 days overdue. Who can take care of this?
@MitchExpensify @aldo-expensify this issue is now 4 weeks old, please consider:
- Finding a contributor to fix the bug
- Closing the issue if BZ has been unable to add the issue to a VIP or Wave project
- If you have any questions, don't hesitate to start a discussion in #expensify-open-source
Thanks!
None of us can reproduce, @izarutskaya can you?
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
@MitchExpensify, @aldo-expensify Whoops! This issue is 2 days overdue. Let's get this updated quick!
Switching to weekly while we wait for reproduction
@MitchExpensify Tester still can reproduce this issue Build v9.0.79-0
https://github.com/user-attachments/assets/3f868399-1576-4865-8258-224a6a9dad39