Skip to content
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

[$500] IOU - Original amount is copied when system message shows the latest amount for paid edited request #33816

Closed
6 tasks done
lanitochka17 opened this issue Jan 1, 2024 · 26 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@lanitochka17
Copy link

lanitochka17 commented Jan 1, 2024

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: 1.4.20-2
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: Applause - Internal Team
Slack conversation:

Action Performed:

Precondition: User A and B have no unsettled IOU

  1. [User B] Navigate to a different conversation
  2. [User A] Request money from User B
  3. [User A] Change the requested amount
  4. [User B] Navigate to the main chat with User A
  5. [User B] Click Pay elsewhere without going to IOU report
  6. [User B] Go to IOU report
  7. [User B] Right click on the paid system message > Copy to clipboard
  8. [User B] Paste the content

Expected Result:

The copied amount is the same as the amount in the system message, which is the latest amount

Actual Result:

The copied amount is the original requested amount, while the system message shows the latest amount

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6329821_1704110791580.20231230_213505.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01447abde9208e3a7c
  • Upwork Job ID: 1741885146524594176
  • Last Price Increase: 2024-01-22
@lanitochka17 lanitochka17 added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jan 1, 2024
@melvin-bot melvin-bot bot changed the title IOU - Original amount is copied when system message shows the latest amount for paid edited request [$500] IOU - Original amount is copied when system message shows the latest amount for paid edited request Jan 1, 2024
Copy link

melvin-bot bot commented Jan 1, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01447abde9208e3a7c

Copy link

melvin-bot bot commented Jan 1, 2024

Triggered auto assignment to @anmurali (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 1, 2024
Copy link

melvin-bot bot commented Jan 1, 2024

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

Copy link

melvin-bot bot commented Jan 1, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @eVoloshchak (External)

@brookbdt
Copy link

brookbdt commented Jan 1, 2024

I have some possible workarounds!

(Client-side)
-> ensure that the action dispatched to update the requested amount is correctly modifying the application's state.
-> ensure that the component displaying the system message is reactively bound to the updated state.
-> ensure that the messages concerning payment updates are correctly processed and that their payload correctly updates
the relevant state. ( Assuming websockets or polling )

(Server-side)
-> When User A updates the requested amount, the back-end should properly handle this update in the database.
-> Ensure that any API endpoint responsible for fetching the payment request data returns the latest state.
-> Verify robust transaction handling in the backend.
-> Use appropriate database locking mechanisms to prevent race conditions, especially if multiple updates can happen in quick succession

In conclusion, by focusing on robust state management, reactive data binding, and ensuring API and database consistency, the issue can be systematically identified and resolved. I am confident it's one of the things listed above!

Copy link

melvin-bot bot commented Jan 1, 2024

📣 @brookbdt! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@brookbdt
Copy link

brookbdt commented Jan 1, 2024

Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~0139f2296710c2db01

Copy link

melvin-bot bot commented Jan 1, 2024

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@brookbdt
Copy link

brookbdt commented Jan 1, 2024

I have some possible workarounds! (Posting again in case you didn't see the previous one since you didn't have my contributor details)

(Client-side)
-> ensure that the action dispatched to update the requested amount is correctly modifying the application's state.
-> ensure that the component displaying the system message is reactively bound to the updated state.
-> ensure that the messages concerning payment updates are correctly processed and that their payload correctly updates
the relevant state. ( Assuming websockets or polling )

(Server-side)
-> When User A updates the requested amount, the back-end should properly handle this update in the database.
-> Ensure that any API endpoint responsible for fetching the payment request data returns the latest state.
-> Verify robust transaction handling in the backend.
-> Use appropriate database locking mechanisms to prevent race conditions, especially if multiple updates can happen in quick succession

In conclusion, by focusing on robust state management, reactive data binding, and ensuring API and database consistency, the issue can be systematically identified and resolved. I am confident it's one of the things listed above!

@rrrshtt
Copy link

rrrshtt commented Jan 1, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

The original amount is copied in the clipboard when the system message shows a different amount.

What is the root cause of that problem?

const reportAction = useMemo(() => {
if (_.isEmpty(props.reportActions) || props.reportActionID === '0') {
return {};
}
return props.reportActions[props.reportActionID] || {};
}, [props.reportActions, props.reportActionID]);

In this line, we memoized "reportAction" for the context menu. This could be the root of the problem because we are retaining old information for the context menu.

What changes do you think we should make in order to solve the problem?

We should ensure that the information in the context menu is up-to-date. For example, we can pass only the ID of the report instead of the full report to the context menu and retrieve information only when we press actual actions.

What alternative solutions did you explore? (Optional)

Alternatively, we can update our memoized hook dependencies to make sure that the information is up-to-date.

@FitseTLT
Copy link
Contributor

FitseTLT commented Jan 1, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

Original amount is copied when system message shows the latest amount for paid edited request

What is the root cause of that problem?

We are getting the amount from originalMessage here

App/src/libs/ReportUtils.ts

Lines 4103 to 4104 in 689c227

const {amount, currency} = originalMessage.IOUDetails ?? originalMessage;
const formattedAmount = CurrencyUtils.convertToDisplayString(amount, currency) ?? '';

But It has the non-updated the original value.

What changes do you think we should make in order to solve the problem?

We can get calculate from via getMoneyRequestReimbursableTotal same as we did to display the report action

App/src/libs/ReportUtils.ts

Lines 2008 to 2009 in 689c227

const totalAmount = getMoneyRequestReimbursableTotal(report);
const policyName = getPolicyName(report, false, policy);

but in case the iouReport doesn't exist we will fallback to the originalMessage amount

const {amount: amountFromMessage, currency} = originalMessage.IOUDetails ?? originalMessage;
        const amount = iouReport ? getMoneyRequestReimbursableTotal(iouReport as OnyxEntry<Report>) : amountFromMessage;

What alternative solutions did you explore? (Optional)

@brunovjk
Copy link
Contributor

brunovjk commented Jan 3, 2024

@FitseTLT when the account B is about to pay, should we get an error feedback? To try again later, with the updated value.

@melvin-bot melvin-bot bot added the Overdue label Jan 3, 2024
Copy link

melvin-bot bot commented Jan 5, 2024

@eVoloshchak, @anmurali Whoops! This issue is 2 days overdue. Let's get this updated quick!

Copy link

melvin-bot bot commented Jan 8, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

Copy link

melvin-bot bot commented Jan 9, 2024

@eVoloshchak, @anmurali Still overdue 6 days?! Let's take care of this!

@anmurali
Copy link

@eVoloshchak - you have some proposals to review!

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jan 10, 2024
@anmurali
Copy link

@eVoloshchak another bump here.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jan 12, 2024
Copy link

melvin-bot bot commented Jan 15, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

Copy link

melvin-bot bot commented Jan 15, 2024

@eVoloshchak @anmurali 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!

@eVoloshchak
Copy link
Contributor

Looks like this might have been resolved, I'm unable to reproduce the issue
@rrrshtt, @FitseTLT, could you double-check if this is still reproducible for you? Thanks

@melvin-bot melvin-bot bot removed the Overdue label Jan 16, 2024
@FitseTLT
Copy link
Contributor

Yep Solved in BE. Can close it

@melvin-bot melvin-bot bot added the Overdue label Jan 18, 2024
@mvtglobally
Copy link

Issue not reproducible during KI retests. (First week)

Copy link

melvin-bot bot commented Jan 19, 2024

@eVoloshchak, @anmurali Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

Copy link

melvin-bot bot commented Jan 22, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

Copy link

melvin-bot bot commented Jan 22, 2024

@eVoloshchak @anmurali this issue is now 3 weeks old. There is one more week left before this issue breaks WAQ and will need to go internal. What needs to happen to get a PR in review this week? Please create a thread in #expensify-open-source to discuss. Thanks!

@anmurali
Copy link

Closing per #33816 (comment) and #33816 (comment)

@melvin-bot melvin-bot bot removed the Overdue label Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

8 participants