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

[$250] After paying only a portion of the expense, user not scroll down to new expense #54655

Open
1 of 8 tasks
m-natarajan opened this issue Dec 30, 2024 · 16 comments
Open
1 of 8 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2

Comments

@m-natarajan
Copy link

m-natarajan commented Dec 30, 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: 9.0.79-4
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?:
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: @dukenv0307
Slack conversation (hyperlinked to channel name): expensify_bugs

Action Performed:

  1. Create 2 expenses
  2. Hold 1 expense
  3. Click pay elsewhere button
  4. Choose Pay only

Expected Result:

The user scrolls down to new expense.

Actual Result:

The user does not scroll down to new expense.

Workaround:

Unknown

Platforms:

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

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
bug.mov

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021874051725449499647
  • Upwork Job ID: 1874051725449499647
  • Last Price Increase: 2024-12-31
  • Automatic offers:
    • FitseTLT | Contributor | 105583454
Issue OwnerCurrent Issue Owner: @
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 30, 2024
Copy link

melvin-bot bot commented Dec 30, 2024

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.

@nkdengineer
Copy link
Contributor

Proposal

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

After paying only a portion of the expense, user not scroll down to new expense.

What is the root cause of that problem?

We are not calling Report.notifyNewAction to scroll down when call API PayMoneyRequest

App/src/libs/actions/IOU.ts

Lines 7924 to 7926 in 12e0941

playSound(SOUNDS.SUCCESS);
API.write(apiCommand, params, {optimisticData, successData, failureData});
}

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

  1. Add function Report.notifyNewAction here
    Report.notifyNewAction(chatReport.reportID, userAccountID);

App/src/libs/actions/IOU.ts

Lines 7924 to 7926 in 12e0941

playSound(SOUNDS.SUCCESS);
API.write(apiCommand, params, {optimisticData, successData, failureData});
}

  1. We also need to update lastVisibleActionCreated of chatReport to make sure that hasNewestReportAction here is true
     lastVisibleActionCreated: optimisticExpenseReportPreview.created,

App/src/libs/actions/IOU.ts

Lines 6730 to 6736 in 12e0941

{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${chatReport.reportID}`,
value: {
iouReportID: optimisticExpenseReport.reportID,
},
},

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

What alternative solutions did you explore? (Optional)

NA

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

@FitseTLT
Copy link
Contributor

FitseTLT commented Dec 30, 2024

Edited by proposal-police: This proposal was edited at 2024-12-30 14:04:11 UTC.

Proposal

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

After paying only a portion of the expense, user not scroll down to new expense

What is the root cause of that problem?

We already notify new action on pay request here

Report.notifyNewAction(iouReport?.reportID ?? '', userAccountID);

but it always notify new action on iou report so when we pay from report preview we are on chat report (not iou report) so it won't work properly and we also missed to update lastVisibleActionCreated on the chat report with the new preview action created from partial hold here

App/src/libs/actions/IOU.ts

Lines 6730 to 6736 in 12e0941

{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${chatReport.reportID}`,
value: {
iouReportID: optimisticExpenseReport.reportID,
},
},

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

We need to know from where the pay request is called we can easily find it by getTopmostReportID or we can pass it as a param (which would be the chat report when paid from the report preview case or the iou Report when paid from money report header case) and then notifyNewAction for that param instead of always notifying for iouReport

Report.notifyNewAction(iouReport?.reportID ?? '', userAccountID);

    Report.notifyNewAction(Navigation.getTopmostReportId() ?? iouReport?.reportID ?? '', userAccountID);

and update lastVisibleActionCreated accordingly here

App/src/libs/actions/IOU.ts

Lines 6740 to 6741 in 12bbe02

value: {
iouReportID: optimisticExpenseReport.reportID,

                lastVisibleActionCreated: optimisticExpenseReportPreview.created,

We have similar problems with approve and other money request flows too so we should fix it similarly.

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

We will mock getTopmostReportID to return the chat report id and then we will assert that the notifyNewAction is called with the chat report id not the iou report.

What alternative solutions did you explore? (Optional)

We can also avoid notifying new action if the pay is from report preview and the payment is full because there is no new action to notify on the chat report

const topReportID = Navigation.getTopmostReportId();
    if (!(topReportID === chatReport.reportID && full)) {
        Report.notifyNewAction(topReportID ?? iouReport?.reportID ?? '', userAccountID);
    }

@dukenv0307
Copy link
Contributor

@MitchExpensify I can help take it as C+ since I had the prior context on this. Thanks

@MitchExpensify MitchExpensify added the External Added to denote the issue can be worked on by a contributor label Dec 31, 2024
@melvin-bot melvin-bot bot changed the title After paying only a portion of the expense, user not scroll down to new expense [$250] After paying only a portion of the expense, user not scroll down to new expense Dec 31, 2024
Copy link

melvin-bot bot commented Dec 31, 2024

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

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

melvin-bot bot commented Dec 31, 2024

Current assignee @dukenv0307 is eligible for the External assigner, not assigning anyone new.

@MitchExpensify MitchExpensify moved this to Bugs and Follow Up Issues in [#whatsnext] #expense Dec 31, 2024
@dukenv0307
Copy link
Contributor

@FitseTLT Your proposal looks promising. Can you add the automated tests to cover this case? We also need to fix the approve flow.

@dukenv0307
Copy link
Contributor

friendly bump @FitseTLT

@FitseTLT
Copy link
Contributor

FitseTLT commented Jan 3, 2025

@dukenv0307 Updated

@dukenv0307
Copy link
Contributor

Thanks @FitseTLT, let's go with @FitseTLT's proposal. We can discuss the test section in detail during PR phase.

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Jan 5, 2025

Triggered auto assignment to @dangrous, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@dangrous
Copy link
Contributor

dangrous commented Jan 6, 2025

Works for me!

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 6, 2025
Copy link

melvin-bot bot commented Jan 6, 2025

📣 @FitseTLT 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@dukenv0307
Copy link
Contributor

@FitseTLT any updates?

@FitseTLT
Copy link
Contributor

FitseTLT commented Jan 8, 2025

Will create PR tomorrow

@dukenv0307
Copy link
Contributor

@FitseTLT bump

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 labels Jan 9, 2025
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. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2
Projects
Status: Bugs and Follow Up Issues
Development

No branches or pull requests

6 participants