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

[HOLD for payment 2025-01-17] [$250] Page not scroll down when hold and unhold expense #54580

Closed
1 of 8 tasks
m-natarajan opened this issue Dec 26, 2024 · 21 comments
Closed
1 of 8 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@m-natarajan
Copy link

m-natarajan commented Dec 26, 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.78-2
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. Go to a workspace
  2. Submit an expense
  3. Go to the expense detail page and click on the header
  4. Hold this expense
  5. Unhold this expense

Expected Result:

After hold and unhold expense, it scrolls to bottom

Actual Result:

After hold and unhold expense, it isn't scrolling to the comment section

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-resize.mp4
Recording.867.mp4

View all open jobs on GitHub

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

melvin-bot bot commented Dec 26, 2024

Triggered auto assignment to @anmurali (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.

@jayeshmangwani
Copy link
Contributor

jayeshmangwani commented Dec 26, 2024

Proposal

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

Page not scroll down when hold and unhold expense

What is the root cause of that problem?

We have added Report.notifyNewAction to the putOnHold and unholdRequest functions. This notifies ReportActionsView that a new comment has arrived. However, we are not dismissing the modal before calling notifyNewAction, which prevents the scroll-to-bottom or scroll-to-unread-message functionality from triggering.

App/src/libs/actions/IOU.ts

Lines 8369 to 8370 in 918488a

const currentReportID = ReportUtils.getDisplayedReportID(reportID);
Report.notifyNewAction(currentReportID, userAccountID);

App/src/libs/actions/IOU.ts

Lines 8487 to 8488 in 918488a

const currentReportID = ReportUtils.getDisplayedReportID(reportID);
Report.notifyNewAction(currentReportID, userAccountID);

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

We should add the dismissModal call in both the putOnHold and unholdRequest functions, prior to invoking Report.notifyNewAction.

+ Navigation.dismissModal(isSearchTopmostCentralPane() ? undefined : currentReportID);

Report.notifyNewAction(currentReportID, userAccountID);

Report.notifyNewAction(currentReportID, userAccountID);

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

N/A

What alternative solutions did you explore? (Optional)

To simplify the implementation, we can create a unified common dismissModal function that handles isSearchTopmostCentralPane in a single location.

@nkdengineer
Copy link
Contributor

Proposal

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

Page not scroll down when hold and unhold expense

What is the root cause of that problem?

In this PR, we wrap this function into the InteractionManager.runAfterInteractions to wait until changing hasNewestReportActionRef.current done

const scrollToBottomForCurrentUserAction = useCallback(
(isFromCurrentUser: boolean) => {
InteractionManager.runAfterInteractions(() => {

And in hold and unhold expense, we don't update lastVisibleActionCreated so hasNewestReportActionRef.current will be false

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

We should update lastVisibleActionCreated when holding and unholding expense

    const currentReportID = ReportUtils.getDisplayedReportID(reportID);
    optimisticData.push({
        onyxMethod: Onyx.METHOD.MERGE,
        key: `${ONYXKEYS.COLLECTION.REPORT}${currentReportID}`,
        value: {
            lastVisibleActionCreated: createdReportAction.created,
        },
    });

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

NA

What alternative solutions did you explore? (Optional)

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.

@dukenv0307
Copy link
Contributor

@anmurali I can take it as C+ since I have the prior context on it

@FitseTLT
Copy link
Contributor

Proposal

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

Page not scroll down when hold and unhold expense

What is the root cause of that problem?

We are notifying new action in hold and unhold but when the scrollToBottom is called hasNewestReportActionRef will be false

if (!hasNewestReportActionRef.current) {
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report.reportID));

This is because we haven't correctly set the transaction thread report lastVisibleActionCreated in optimsitcData to created of the last action we added optimistically

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

We need to also optimistically set lastVisibleActionCreated of the transactionThreadReport to the last action.created. In putOnHold we need to set the lastVisibleActionCreated to createdReportActionComment.created because it is the last report action we have optimsitcally added.

optimisticData.push({
        onyxMethod: Onyx.METHOD.MERGE,
        key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
        value: {
            lastVisibleActionCreated: createdReportActionComment.created,
        },
    });

and in unHoldRequest we set it to createdReportAction.created

optimisticData.push({
        onyxMethod: Onyx.METHOD.MERGE,
        key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
        value: {
            lastVisibleActionCreated: createdReportAction.created,
        },
    });

Note:

1.Setting it to createdReportAction.created will not solve the problem as the last action createdReportActionComment is 1 milisecond greater than createdReportAction.created

const createdReportActionComment = ReportUtils.buildOptimisticHoldReportActionComment(comment, DateUtils.addMillisecondsFromDateTime(currentTime, 1));

so hasNewestReportActionRef will still be false.
2. We need to update created of the transactionThreadReport not getDisplayedReportID (as getDisplayedReportID is the parent report id of the transactionThread for the case of the single transaction thread) as we are adding the actions to the transactionThread and that is exactly what the BE sets too 👍

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

What alternative solutions did you explore? (Optional)

@melvin-bot melvin-bot bot added the Overdue label Dec 30, 2024
Copy link

melvin-bot bot commented Dec 30, 2024

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

@anmurali anmurali 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 Page not scroll down when hold and unhold expense [$250] Page not scroll down when hold and unhold expense Dec 31, 2024
Copy link

melvin-bot bot commented Dec 31, 2024

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

@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

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

@paultsimura
Copy link
Contributor

Reviewing soon 👀

@paultsimura
Copy link
Contributor

Important

A note for all the contributors in this GH: please do not ignore the "Automated tests" section of the proposal. This solution can and should be covered with a unit test.

The proposal by @FitseTLT is the most complete and points out important pros over the previous similar proposal. I'd go with it.

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Jan 1, 2025

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

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

melvin-bot bot commented Jan 2, 2025

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

Offer link
Upwork job

Copy link

melvin-bot bot commented Jan 2, 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 📖

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 Weekly KSv2 labels Jan 3, 2025
@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production labels Jan 10, 2025
@melvin-bot melvin-bot bot changed the title [$250] Page not scroll down when hold and unhold expense [HOLD for payment 2025-01-17] [$250] Page not scroll down when hold and unhold expense Jan 10, 2025
Copy link

melvin-bot bot commented Jan 10, 2025

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jan 10, 2025
Copy link

melvin-bot bot commented Jan 10, 2025

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.82-12 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2025-01-17. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Jan 10, 2025

@paultsimura @anmurali @paultsimura The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@paultsimura
Copy link
Contributor

paultsimura commented Jan 14, 2025

BugZero Checklist:

  • [Contributor] Classify the bug:
Bug classification

Source of bug:

  • 1a. Result of the original design (eg. a case wasn't considered)
  • 1b. Mistake during implementation
  • 1c. Backend bug
  • 1z. Other:

Where bug was reported:

  • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
  • 2b. Reported on staging (eg. found during regression or PR testing)
  • 2d. Reported on a PR
  • 2z. Other:

Who reported the bug:

  • 3a. Expensify user
  • 3b. Expensify employee
  • 3c. Contributor
  • 3d. QA
  • 3z. Other:
  • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

    Link to comment: https://github.com/Expensify/App/pull/38738/files#r1915334935

  • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

    Link to discussion: N/A

  • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

  • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

    Link to issue:

Regression Test Proposal

Test:

  1. Go to a workspace
  2. Submit an expense
  3. Go to the expense detail page and click on the header
  4. Hold the expense
  5. Verify that you are scrolled to the bottom
  6. Click on the header
  7. Unhold this expense
  8. Verify that you are scrolled to the bottom

Do we agree 👍 or 👎

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jan 16, 2025
@paultsimura
Copy link
Contributor

paultsimura requires payment automatic offer (Reviewer)
FitseTLT requires payment automatic offer (Contributor)
dukenv0307 requires payment through NewDot Manual Requests

BTW, this summary is incorrect - only me and @FitseTLT require payment.

@melvin-bot melvin-bot bot added the Overdue label Jan 20, 2025
Copy link

melvin-bot bot commented Jan 21, 2025

@paultsimura, @anmurali, @techievivek, @FitseTLT Huh... This is 4 days overdue. Who can take care of this?

@dylanexpensify
Copy link
Contributor

Payment completed!

@anmurali
Copy link

Added regression test as well.

@melvin-bot melvin-bot bot removed the Overdue label Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

9 participants