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

Request money: 0.00 is shown for a seconds before updating its amount #25523

Closed
1 of 6 tasks
kavimuru opened this issue Aug 19, 2023 · 8 comments
Closed
1 of 6 tasks

Request money: 0.00 is shown for a seconds before updating its amount #25523

kavimuru opened this issue Aug 19, 2023 · 8 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering

Comments

@kavimuru
Copy link

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Open the website
  2. click the + icon from LHN
  3. click the request money
  4. request money from user 1 to user 2
  5. observe the result from user 2

Expected Result:

  1. the requested amount is not to be 0.00 for a seconds

Actual Result:

the requested money is 0.00 for a second

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.55-5
Reproducible in staging?: y
Reproducible in production?: n
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
Notes/Photos/Videos: Any additional supporting documentation

Screenshare.-.2023-08-18.8_55_29.PM.mp4
Recording.1478.mp4

Expensify/Expensify Issue URL:
Issue reported by: @misgana96
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1692242726950869

View all open jobs on GitHub

@kavimuru kavimuru added DeployBlockerCash This issue or pull request should block deployment Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 19, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 19, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 19, 2023

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

@OSBotify
Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open StagingDeployCash deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Aug 19, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 19, 2023

Current assignee @puneetlath is eligible for the Engineering assigner, not assigning anyone new.

@parteekcoder
Copy link

Can I work on this issue @puneetlath ?

@s-alves10
Copy link
Contributor

Proposal

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

Request money: show 0.00 for seconds before updating its amount

What is the root cause of that problem?

This is a regression from this PR

Now we are getting amount and currency info from the transaction

const transaction = TransactionUtils.getLinkedTransaction(props.action);
const {amount: requestAmount, currency: requestCurrency, comment: requestComment} = ReportUtils.getTransactionDetails(transaction);

We get pusher events for the newly created iou action but that events don't include any transaction data as you can see in the below screenshot
image

We get transaction data when opening report
image

When we open an IOU report, we have all actions data(from pusher events) but don't have transaction data. So TransactionUtils.getLinkedTransaction returns empty object until OpenReport API call is finished.

This is the root cause

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

Here is a solution

  1. Restore the getMoneyRequestAction function in ReportUtils.js
function getMoneyRequestAction(reportAction = {}) {
    const originalMessage = lodashGet(reportAction, 'originalMessage', {});
    let amount = originalMessage.amount || 0;
    let currency = originalMessage.currency || CONST.CURRENCY.USD;
    let comment = originalMessage.comment || '';

    if (_.has(originalMessage, 'IOUDetails')) {
        amount = lodashGet(originalMessage, 'IOUDetails.amount', 0);
        currency = lodashGet(originalMessage, 'IOUDetails.currency', CONST.CURRENCY.USD);
        comment = lodashGet(originalMessage, 'IOUDetails.comment', '');
    }

    return {amount, currency, comment};
}
  1. If transaction is empty, get the transaction data from the iou action.
    Replace this line
    const transaction = TransactionUtils.getLinkedTransaction(props.action);

with

    let transaction = TransactionUtils.getLinkedTransaction(props.action);
    if (_.isEmpty(transaction)) {
        transaction = ReportUtils.getMoneyRequestAction(props.action)
    }

This works as expected

Note: This is a workaround. I am suggesting this because this is a deploy blocker. This issue should be fixed in the backend(The backend should send pusher event including transaction)

What alternative solutions did you explore? (Optional)

@mountiny
Copy link
Contributor

@s-alves10 this is not valid solution as we cannot rely on the reportAction data when request is being edited.

@puneetlath This is not a deploy blocker fwiw. The reason is that the ReportActionItem is not re-rendering when the transaction object changes, but we are working on this with @luacmartins and should be resolved soon

@mountiny mountiny removed the DeployBlockerCash This issue or pull request should block deployment label Aug 21, 2023
@mountiny mountiny assigned luacmartins and mountiny and unassigned puneetlath Aug 21, 2023
@luacmartins
Copy link
Contributor

This has the same root cause and is a dupe of #24608. Closing.

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
Projects
None yet
Development

No branches or pull requests

7 participants