[$250] Negative amount shows in workspace invoice room on fresh sign-in
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.17-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: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: @jjcoffee Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1723024665726109
Action Performed:
Precondition: Having User A as a high traffic account with multiple workspaces
- [User A] Send an invoice to any workspace.
- [User A] Copy the link to the invoice room.
- [User B] Open the invoice, tap Pay and select to pay the invoice as an individual and pay elsewhere.
- [User A] Sign out and sign back in.
- [User A] Paste and open the link in (2)
Expected Result:
The invoice room opens with a report preview showing the correct payment amount, avatars and names showing correctly.
Actual Result:
The payment amount shows as negative and states "owes" even though it has been paid. The avatar and names are also blank.
Workaround:
unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
- [x] Android: Native
- [x] Android: mWeb Chrome
- [x] iOS: Native
- [x] iOS: mWeb Safari
- [x] MacOS: Chrome / Safari
- [x] MacOS: Desktop
Screenshots/Videos
https://github.com/user-attachments/assets/9f86ff6b-e16a-4250-92dc-d4cd13486c13
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~018cd4e107649aaaa3
- Upwork Job ID: 1821401307948474873
- Last Price Increase: 2024-09-05
Issue Owner
Current Issue Owner: @cristipaval
Triggered auto assignment to @jliexpensify (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.
Job added to Upwork: https://www.upwork.com/jobs/~018cd4e107649aaaa3
Triggered auto assignment to Contributor-plus team member for initial proposal review - @rayane-djouah (External)
Hi @rayane-djouah are you able to reproduce this one?
There's a precondition: Having User A as a high traffic account with multiple workspaces (I don't have a high-traffic account)
Yes, I'm able to reproduce
https://github.com/user-attachments/assets/f4da09eb-a7c4-451b-a81b-fc634da3ce4a
Edited by proposal-police: This proposal was edited at 2024-08-12 13:14:43 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Negative amount shows in workspace invoice room on fresh sign-in
What is the root cause of that problem?
We're getting the value from iouReport for the invoice report, but after we fresh sign in and open the room, we did not yet fetch the Invoice report data, so when we try to find inside the Onyx data it will return undefined
https://github.com/Expensify/App/blob/87bdc246318f6c3fc81ad9d293024de687e457a2/src/components/ReportActionItem/ReportPreview.tsx#L529-L531
So when we open the Invoice report and go back it will show the correct info because we've fetched the invoice report data
What changes do you think we should make in order to solve the problem?
We can check if the iouReport data is undefined, then we can fetch the Invoice report by using openReport function
const fetchIOUReport = useCallback(() => {
ReportActions.openReport(iouReportID);
}, [iouReportID]);
useEffect(() => {
if(!isEmptyObject(iouReport)) {
return;
}
fetchIOUReport()
}, [iouReport])
I think we need to add skeleton for loading when fetching the IOU report
What alternative solutions did you explore? (Optional)
@rayane-djouah Please kindly review above proposal. Thanks
Will review today
@NJ-2020 - Is this bug reproducible with expense reports? If not, Could you please explain why this is happening for the invoice report only?
@rayane-djouah Yes its not happening with expense reports, I think this is because BE issue like for negative amount the BE return text with negative amount on the message property:
For avatar returning undefined because the ownerAccountID & actorAccountID return undefined because of backend issue, but when checking on the action report the BE return actorAccountID with a value
https://github.com/Expensify/App/blob/b7f7f1b4f36451b4e3a763ac717e1c8fd645ee5a/src/pages/home/report/ReportActionItemSingle.tsx#L84
https://github.com/Expensify/App/blob/b7f7f1b4f36451b4e3a763ac717e1c8fd645ee5a/src/pages/home/report/ReportActionItemSingle.tsx#L96
But here we're getting the property value of managerID or ownerAccountID inside of iouReport(undefined because not yet fetched) or childManagerAccountID or childOwnerAccountID inside reportAction
https://github.com/Expensify/App/blob/b7f7f1b4f36451b4e3a763ac717e1c8fd645ee5a/src/libs/ReportUtils.ts#L7358-L7361
And also for text owes instead of paid because on the iouSettled we're checking inside iouReport or reportAction.childStatusNum is equal to CONST.REPORT.STATUS_NUM.REIMBURSED which is 4, but the reportAction.childStatusNum returning 0 which will return false and return the owes text instead of paid
But i think we can solve it on the FE by fetching the Invoice report data Thanks
@rayane-djouah Please let me know your thought.
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
@cristipaval - Could you please take a look at @NJ-2020's proposal and determine whether it's acceptable to fix the bug on the frontend by fetching the invoice report if it’s undefined in the report preview action component, or if it needs to be addressed on the backend?
I need to check how it works for the expense reports.
Not overdue, waiting on Cristi
On my list for today.
@cristipaval @jliexpensify @rayane-djouah 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!
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
@cristipaval, @jliexpensify, @rayane-djouah Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
Waiting on @cristipaval
@cristipaval - Can we move forward with the fronted fix instead of dealing with backend issues?
Bump @cristipaval ^
DM-ed Cristi
I can't reproduce this one with the latest develop.
@cristipaval The issue is still reproducible on the latest main , note: you must have a high traffic account
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
@cristipaval, @jliexpensify, @rayane-djouah Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
Bump @cristipaval
@cristipaval This is reproducible with a HT account with multiple workspaces
Unfortunately, I won't have time to dig more into this one, and I'm off starting on Monday. Maybe @madmax330 could help, given that he also has knowledge about Invoicing.