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 2024-11-21] [$250] After hold and unhold expense page is not scrolling down to comments section #49959

Closed
1 of 6 tasks
m-natarajan opened this issue Sep 30, 2024 · 67 comments
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 Sep 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.41-6
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: @dukenv0307
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1727724158339229

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 is scroll 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: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

bug.1.mov

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021841168390578719829
  • Upwork Job ID: 1841168390578719829
  • Last Price Increase: 2024-10-29
  • Automatic offers:
    • dukenv0307 | Reviewer | 104747445
    • nkdengineer | Contributor | 104747448
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @sakluger
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 30, 2024
Copy link

melvin-bot bot commented Sep 30, 2024

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

nkdengineer commented Sep 30, 2024

Edited by proposal-police: This proposal was edited at 2024-10-11 04:44:02 UTC.

Proposal

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

After hold and unhold expense is not scrolling down

What is the root cause of that problem?

After hold and unhold expense, we don't have any logic to scroll

'HoldRequest',

'UnHoldRequest',

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

We should use Report.notifyNewAction in 2 function unholdRequest and putOnHold to scroll to the bottom of this report like we did in other places

    API.write(
        'HoldRequest',
    ...
    );
    const report = ReportUtils.getReport(reportID);
    const parentReportAction = ReportActionsUtils.getReportAction(report?.parentReportID ?? '-1', report?.parentReportActionID ?? '-1');
    const currentReportID = ReportUtils.isOneTransactionThread(report?.reportID ?? '', report?.parentReportID ?? '', parentReportAction) ? report?.parentReportID : reportID ;
    
    Report.notifyNewAction(currentReportID, userAccountID);
    API.write(
        'UnHoldRequest',
    ...
    );
    const report = ReportUtils.getReport(reportID);
    const parentReportAction = ReportActionsUtils.getReportAction(report?.parentReportID ?? '-1', report?.parentReportActionID ?? '-1');
    const currentReportID = ReportUtils.isOneTransactionThread(report?.reportID ?? '', report?.parentReportID ?? '', parentReportAction) ? report?.parentReportID : reportID ;

    Report.notifyNewAction(currentReportID, userAccountID);

What alternative solutions did you explore? (Optional)

@dukenv0307
Copy link
Contributor

@sakluger I report this bug so I can help take it as C+

@huult
Copy link
Contributor

huult commented Oct 1, 2024

Proposal

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

After hold and unhold expense page is not scrolling down to comments section

What is the root cause of that problem?

We haven't handled scrolling to the bottom when HOLD or UNHOLD changes yet

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

We should check if sortedVisibleReportActions has changed to include HOLD or UNHOLD in order to determine if we need to scroll to the bottom. Something like this:

//.src/pages/home/report/ReportActionsList.tsx#L203
+const previousReport = useRef<OnyxTypes.ReportAction[]>([]);
+ useEffect(() => {
+        if (!previousReport.current && Array.isArray(sortedVisibleReportActions) && sortedVisibleReportActions.length) {
+            previousReport.current = sortedVisibleReportActions;
+            return;
+        }

+        if (Array.isArray(sortedVisibleReportActions) && sortedVisibleReportActions.length) {
+            const previousActions = previousReport.current || [];

+            const newActions = sortedVisibleReportActions.filter((newAction) => !previousActions.some((prevAction) => +prevAction.reportActionID === newAction.reportActionID));
+            const containsHoldOrUnhold = newActions.some((action) => action?.actionName === 'HOLD' || action?.actionName + === 'UNHOLD');

+            if (containsHoldOrUnhold) {
+                InteractionManager.runAfterInteractions(() => {
+                    requestAnimationFrame(() => {
+                        reportScrollManager.scrollToBottom();
+                    });
+                });
+            }

+            previousReport.current = sortedVisibleReportActions;
+        }
+    }, [reportScrollManager, sortedVisibleReportActions]);
POC
Screen.Recording.2024-10-01.at.11.59.24.mov

@sakluger sakluger added the External Added to denote the issue can be worked on by a contributor label Oct 1, 2024
@melvin-bot melvin-bot bot changed the title After hold and unhold expense page is not scrolling down to comments section [$250] After hold and unhold expense page is not scrolling down to comments section Oct 1, 2024
Copy link

melvin-bot bot commented Oct 1, 2024

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

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

melvin-bot bot commented Oct 1, 2024

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

@sakluger
Copy link
Contributor

sakluger commented Oct 1, 2024

Thanks @dukenv0307!

@raza-ak
Copy link
Contributor

raza-ak commented Oct 2, 2024

Proposal

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

After hold and unhold expense page is not scrolling down to comments section

What is the root cause of that problem?

The "ReportActionsList.tsx" component does not currently handle auto-scrolling when new messages or comments are added. As a result, the page does not scroll to the latest comment when an expense is held or unheld.

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

We will update the "ReportActionsList.tsx" component to detect when a new message arrives and implement automatic scrolling to the latest comment whenever an expense is held or unheld. This will ensure that the page always scrolls down to display the newest message.
image
Video:

372422564-47842cb7-2be7-4562-bd9d-3b2cac706e1d.mp4

@dukenv0307
Copy link
Contributor

I'm reviewing...

@melvin-bot melvin-bot bot added the Overdue label Oct 7, 2024
@sakluger
Copy link
Contributor

sakluger commented Oct 7, 2024

@dukenv0307 any updates?

@melvin-bot melvin-bot bot removed the Overdue label Oct 7, 2024
@dukenv0307
Copy link
Contributor

@sakluger I'll update in a few hours. The first proposal looks promising, but sometime it doesn't work

@dukenv0307
Copy link
Contributor

@nkdengineer I tested your proposal, but sometime it doesn't work, especially when there's only one money request. Can you check again?

Copy link

melvin-bot bot commented Oct 8, 2024

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

@nkdengineer
Copy link
Contributor

@dukenv0307 i'll update today

@huult
Copy link
Contributor

huult commented Oct 10, 2024

@dukenv0307 Could you please review my proposal and POC? It is working as expected.

@dukenv0307
Copy link
Contributor

@huult

We should check if sortedVisibleReportActions has changed to include HOLD or UNHOLD in order to determine if we need to scroll to the bottom. Something like this:

I don't think it's a good idea, when users add a new comment, the list automatically scrolls to the bottom without checking sortedVisibleReportActions has new action. We should do the same as Add comment

@raza-ak
Copy link
Contributor

raza-ak commented Oct 10, 2024

@dukenv0307 Did you check my proposal?

@dukenv0307
Copy link
Contributor

@raza-ak We don't need to do that for every new message. For example the whisper message, new message from others, ...

@nkdengineer
Copy link
Contributor

@dukenv0307 i looks like with one transaction thread, the reportID in this function is the reportID of the transaction

function putOnHold(transactionID: string, comment: string, reportID: string, searchHash?: number) {

and the reportID in here is the reportID of transaction thread
const unsubscribe = Report.subscribeToNewActionEvent(report.reportID, scrollToBottomForCurrentUserAction);

so when we call notifyNewAction it can't run callback function scrollToBottomForCurrentUserAction

updated proposal

@melvin-bot melvin-bot bot added the Overdue label Oct 14, 2024
@sakluger
Copy link
Contributor

We're still reviewing proposals.

Copy link

melvin-bot bot commented Nov 5, 2024

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

@mjasikowski
Copy link
Contributor

let's go with @nkdengineer's proposal!

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 5, 2024
Copy link

melvin-bot bot commented Nov 5, 2024

📣 @dukenv0307 🎉 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 Nov 5, 2024

📣 @nkdengineer 🎉 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 labels Nov 6, 2024
@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Nov 14, 2024
@melvin-bot melvin-bot bot changed the title [$250] After hold and unhold expense page is not scrolling down to comments section [HOLD for payment 2024-11-21] [$250] After hold and unhold expense page is not scrolling down to comments section Nov 14, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Nov 14, 2024
Copy link

melvin-bot bot commented Nov 14, 2024

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

Copy link

melvin-bot bot commented Nov 14, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.61-3 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 2024-11-21. 🎊

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

Copy link

melvin-bot bot commented Nov 14, 2024

@dukenv0307 @sakluger @dukenv0307 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]

@garrettmknight garrettmknight moved this from Bugs and Follow Up Issues to Hold for Payment in [#whatsnext] #expense Nov 14, 2024
@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Nov 20, 2024
@sakluger
Copy link
Contributor

Payment date is tomorrow. @dukenv0307 - please complete the BZ checklist by tomorrow, thanks.

@dukenv0307
Copy link
Contributor

dukenv0307 commented Nov 21, 2024

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
  • 2b. Reported on staging (deploy blocker)
  • 2c. 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/33897/files#r1851278165

  • [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. Yes

Regression Test Proposal Template
  • [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 this expense
  5. Unhold this expense
  6. Verify that: After hold and unhold expense, it is scroll to bottom

Do we agree 👍 or 👎

@mjasikowski
Copy link
Contributor

@dukenv0307 looks good, I'd suggest to make point 6 a bit more precise:

Verify that the expense view automatically scrolls to bottom of the page

@sakluger
Copy link
Contributor

Summarizing payment on this issue:

Contributor: @nkdengineer $250, paid via Upwork
Contributor+: @dukenv0307 $250, paid via Upwork

FYI, I received errors when completing both contracts in Upwork. I double-checked that they were paid, but please raise in Slack and tag me if there were any issues with payment.

@github-project-automation github-project-automation bot moved this from Hold for Payment to Done in [#whatsnext] #expense Nov 21, 2024
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
Status: Done
Development

No branches or pull requests

8 participants