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

[Awaiting checklist] [$250] mWeb - Chat - Chat not autoscrolled when categorized expense is sent to chat with content. #54001

Closed
1 of 8 tasks
IuliiaHerets opened this issue Dec 12, 2024 · 37 comments
Assignees
Labels
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

@IuliiaHerets
Copy link

IuliiaHerets commented Dec 12, 2024

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


Version Number: 9.0.75-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: #52221
Email or phone of affected tester (no customers): ibellicotest+91@gmail.com
Issue reported by: Applause Internal Team
Device used: Motorola MotoG60 - Android 12
App Component: Money Requests

Action Performed:

Precondition: Workspace to submit categorized expense, must have an expense on it.

  1. Open the staging.new.expensify.com
  2. Open self DM and tap on the "+" button
  3. Select "Track Expense" and complete the creation flow.
  4. Once naviagted to chat again, tap on "Categorize it"
  5. Select any category.
  6. Add a merchant.
  7. Submit the expense to a workspace that already has an expense or content on it.

Expected Result:

When categorizing an expense and submitting it to a workspace that already has content in it, the chat should be autoscrolled.

Actual Result:

Chat is not autoscrolled after categorizing an expense and submitting it to a workspace chat that already has an expense or content in it.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6691800_1733981730882.Categorize.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021867328605330762929
  • Upwork Job ID: 1867328605330762929
  • Last Price Increase: 2025-01-02
  • Automatic offers:
    • shubham1206agra | Reviewer | 105580363
Issue OwnerCurrent Issue Owner: @shubham1206agra
@IuliiaHerets IuliiaHerets added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 12, 2024
Copy link

melvin-bot bot commented Dec 12, 2024

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

@bernhardoj
Copy link
Contributor

Proposal

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

The categorized track expense isn't shown fully because the chat isn't auto scrolled to the bottom.

What is the root cause of that problem?

This only happens with WS track expense. This issue happens when the report last action created value doesn't match the report lastVisibleActionCreated.

const hasNewestReportAction =
visibleReportActions.at(0)?.created === report.lastVisibleActionCreated || visibleReportActions.at(0)?.created === transactionThreadReport?.lastVisibleActionCreated;

const shouldEnableAutoScroll = (hasNewestReportAction && (!reportActionID || !isNavigatingToLinkedMessage)) || (transactionThreadReport && !prevTransactionThreadReport);

When we create a track expense, including categorizing it, we don't update the lastVisibleActionCreated at all.

App/src/libs/actions/IOU.ts

Lines 1507 to 1514 in 50c1db8

onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${chatReport.reportID}`,
value: {
...chatReport,
lastMessageText: ReportActionsUtils.getReportActionText(iouAction),
lastMessageHtml: ReportActionsUtils.getReportActionHtml(iouAction),
lastReadTime: DateUtils.getDBTime(),
iouReportID: iouReport?.reportID,

This doesn't happen to, money requests, for example. If we see here, we don't set the lastVisibleActionCreated too for the money request.

App/src/libs/actions/IOU.ts

Lines 696 to 702 in 50c1db8

value: {
...chat.report,
lastReadTime: DateUtils.getDBTime(),
lastMessageTranslationKey: '',
iouReportID: iou.report.reportID,
...outstandingChildRequest,
...(isNewChatReport ? {pendingFields: {createChat: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD}} : {}),

But we actually mutate the chat report lastVisibleActionCreated here when a new report preview is created.

App/src/libs/actions/IOU.ts

Lines 2339 to 2343 in 50c1db8

if (reportPreviewAction) {
reportPreviewAction = ReportUtils.updateReportPreview(iouReport, reportPreviewAction, false, comment, optimisticTransaction);
} else {
reportPreviewAction = ReportUtils.buildOptimisticReportPreview(chatReport, iouReport, comment, optimisticTransaction);
chatReport.lastVisibleActionCreated = reportPreviewAction.created;

Also, if we do a track expense directly on the WS (without going through Categorize flow), then it works fine even though we don't update the lastVisibleActionCreated. That's because we trigger notifyNewAction which will scroll the chat to the bottom.

Report.notifyNewAction(activeReportID ?? '', payeeAccountID);

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

I don't like mutating the object and instead of using notifyNewAction, it's better to fix the root cause of the lastVisibleActionCreated optimistic data. So, to fix this, we can update the lastVisibleActionCreated to the report preview action if we are creating a new report preview.

App/src/libs/actions/IOU.ts

Lines 1515 to 1523 in 8ed48d2

onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${chatReport.reportID}`,
value: {
...chatReport,
lastMessageText: ReportActionsUtils.getReportActionText(iouAction),
lastMessageHtml: ReportActionsUtils.getReportActionHtml(iouAction),
lastReadTime: DateUtils.getDBTime(),
iouReportID: iouReport?.reportID,
},

...(shouldCreateNewMoneyRequestReport && {lastVisibleActionCreated: reportPreviewAction?.created}),

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

We can create a test for buildOnyxDataForTrackExpense and test the optimistic data of the chat report when shouldCreateNewMoneyRequestReport is true and false.

@twisterdotcom twisterdotcom added the External Added to denote the issue can be worked on by a contributor label Dec 12, 2024
@melvin-bot melvin-bot bot changed the title mWeb - Chat - Chat not autoscrolled when categorized expense is sent to chat with content. [$250] mWeb - Chat - Chat not autoscrolled when categorized expense is sent to chat with content. Dec 12, 2024
Copy link

melvin-bot bot commented Dec 12, 2024

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

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

melvin-bot bot commented Dec 12, 2024

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

Copy link

melvin-bot bot commented Dec 16, 2024

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

@melvin-bot melvin-bot bot added the Overdue label Dec 16, 2024
@twisterdotcom
Copy link
Contributor

Still Help Wanted

Copy link

melvin-bot bot commented Dec 18, 2024

@twisterdotcom, @shubham1206agra Eep! 4 days overdue now. Issues have feelings too...

@twisterdotcom
Copy link
Contributor

Same. Making weekly over the holidays.

@melvin-bot melvin-bot bot removed the Overdue label Dec 19, 2024
@twisterdotcom twisterdotcom added Weekly KSv2 and removed Daily KSv2 labels Dec 19, 2024
@bernhardoj
Copy link
Contributor

bernhardoj commented Dec 19, 2024

I already have a proposal above in case you missed it

@twisterdotcom
Copy link
Contributor

Ah, @shubham1206agra let's get it reviewed!

@shubham1206agra
Copy link
Contributor

Let's go with @bernhardoj's proposal.

🎀👀🎀 C+ Reviewed

Copy link

melvin-bot bot commented Dec 19, 2024

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

Copy link

melvin-bot bot commented Dec 19, 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 Dec 26, 2024

@twisterdotcom @srikarparsi @shubham1206agra 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!

Copy link

melvin-bot bot commented Dec 26, 2024

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

@mvtglobally
Copy link

Issue not reproducible during KI retests. (First week)

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

melvin-bot bot commented Jan 2, 2025

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

@melvin-bot melvin-bot bot added Monthly KSv2 and removed Weekly KSv2 labels Jan 31, 2025
Copy link

melvin-bot bot commented Jan 31, 2025

This issue has not been updated in over 15 days. @twisterdotcom, @srikarparsi, @bernhardoj, @shubham1206agra eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

@shubham1206agra
Copy link
Contributor

Pending review from @srikarparsi

Copy link

melvin-bot bot commented Feb 7, 2025

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Monthly KSv2 labels Feb 11, 2025
@melvin-bot melvin-bot bot changed the title [$250] mWeb - Chat - Chat not autoscrolled when categorized expense is sent to chat with content. [Due for payment 2025-02-18] [$250] mWeb - Chat - Chat not autoscrolled when categorized expense is sent to chat with content. Feb 11, 2025
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Feb 11, 2025
Copy link

melvin-bot bot commented Feb 11, 2025

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

Copy link

melvin-bot bot commented Feb 11, 2025

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.95-6 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-02-18. 🎊

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

Copy link

melvin-bot bot commented Feb 11, 2025

@shubham1206agra @twisterdotcom @shubham1206agra 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]

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Feb 17, 2025
@twisterdotcom
Copy link
Contributor

twisterdotcom commented Feb 18, 2025

Payment Summary:

@twisterdotcom twisterdotcom removed the Awaiting Payment Auto-added when associated PR is deployed to production label Feb 18, 2025
@twisterdotcom twisterdotcom changed the title [Due for payment 2025-02-18] [$250] mWeb - Chat - Chat not autoscrolled when categorized expense is sent to chat with content. [Awaiting checklist] [$250] mWeb - Chat - Chat not autoscrolled when categorized expense is sent to chat with content. Feb 18, 2025
@bernhardoj
Copy link
Contributor

Requested in ND.

@JmillsExpensify
Copy link

$250 approved for @bernhardoj

Copy link

melvin-bot bot commented Feb 21, 2025

@twisterdotcom, @srikarparsi, @bernhardoj, @shubham1206agra Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@shubham1206agra
Copy link
Contributor

shubham1206agra commented Feb 22, 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/36934/files#r1966458419

  • [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: Not Required

  • [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: https://github.com/Expensify/Expensify/issues/473689

Regression Test Proposal

Test:

  1. Open a workspace chat with no unsettled expenses
  2. Split bill on the workspace
  3. Verify the chat is scrolled to the bottom

Do we agree 👍 or 👎

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Feb 22, 2025
@melvin-bot melvin-bot bot removed the Overdue label Feb 24, 2025
@twisterdotcom
Copy link
Contributor

Please accept the Upwork offer now @shubham1206agra.

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 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

8 participants