App icon indicating copy to clipboard operation
App copied to clipboard

[$250] mWeb - Group chat - On creating group chat, chat report is shown briefly in header.

Open IuliiaHerets opened this issue 1 year ago • 12 comments

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: V9. 0.73-6 Reproducible in staging?: Yes Reproducible in production?: No If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A If this was caught during regression testing, add the test name, ID and link from TestRail: N Email or phone of affected tester (no customers): N Issue reported by: Applause Internal Team

Action Performed:

  1. Go to https://staging.new.expensify.com/home
  2. Tap fab-- start chat
  3. Select a user and create a group chat
  4. Note the header

Expected Result:

On creating group chat, chat report must not be shown briefly in header.

Actual Result:

On creating group chat, chat report is shown briefly in header.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

https://github.com/user-attachments/assets/2692c4c7-14f5-4d95-9c64-b4c32550f0e7

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021866441003573597899
  • Upwork Job ID: 1866441003573597899
  • Last Price Increase: 2024-12-10
Issue OwnerCurrent Issue Owner: @

IuliiaHerets avatar Dec 10 '24 09:12 IuliiaHerets

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

melvin-bot[bot] avatar Dec 10 '24 09:12 melvin-bot[bot]

Triggered auto assignment to @cristipaval (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

melvin-bot[bot] avatar Dec 10 '24 09:12 melvin-bot[bot]

💬 A slack conversation has been started in #expensify-open-source

melvin-bot[bot] avatar Dec 10 '24 09:12 melvin-bot[bot]

:wave: 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[bot] avatar Dec 10 '24 09:12 github-actions[bot]

Production

https://github.com/user-attachments/assets/33d0a9e0-c115-4c7e-9c52-9d17ee7a591b

IuliiaHerets avatar Dec 10 '24 09:12 IuliiaHerets

Proposal

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

When starting group chat with 1 user, chat report name shows default chat name briefly.

What is the root cause of that problem?

Since report name isn't defined here:

https://github.com/Expensify/App/blob/9fe5511a6c9502c289c129543a09a4fa5f33f65e/src/pages/NewChatConfirmPage.tsx#L107

buildOptimisticChatReport function decide report name temporarily.

https://github.com/Expensify/App/blob/9fe5511a6c9502c289c129543a09a4fa5f33f65e/src/libs/ReportUtils.ts#L5428-L5430

So till getting data from BE API, the chat report name shows default name.

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

We can use groupName:

https://github.com/Expensify/App/blob/9fe5511a6c9502c289c129543a09a4fa5f33f65e/src/pages/NewChatConfirmPage.tsx#L63

instead of newGroupDraft.reportName here:

https://github.com/Expensify/App/blob/9fe5511a6c9502c289c129543a09a4fa5f33f65e/src/pages/NewChatConfirmPage.tsx#L107

What alternative solutions did you explore? (Optional)

N/A

jacobkim9881 avatar Dec 10 '24 10:12 jacobkim9881

Proposal

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

On creating group chat, chat report is shown briefly in header.

What is the root cause of that problem?

It comes from https://github.com/Expensify/App/pull/53203.

We get the metadata from ReportUtils.getReportMetadata(report?.reportID), but it isn't updated in real time when we create a new report. This causes openReport to be called twice.

https://github.com/Expensify/App/blob/9fe5511a6c9502c289c129543a09a4fa5f33f65e/src/libs/shouldFetchReport.ts#L6

In mWeb, for the second time openReport, reportActionsExist(reportID) still is false because allReportActions is updated after we call the second openReport. Then the report name of the group chat is changed to Chat Report and it's returned here

https://github.com/Expensify/App/blob/9fe5511a6c9502c289c129543a09a4fa5f33f65e/src/libs/actions/Report.ts#L814

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

Instead of getting the reportMetadata from ReportUtils.getReportMetadata(report?.reportID), we should pass the reportMetadata from the component that uses this function.

export default function shouldFetchReport(report: OnyxEntry<Report>, reportMetadata: OnyxEntry<ReportMetadata>) {
    // If the report is optimistic, there's no need to fetch it. The original action should create it.
    // If there is an error for creating the chat, there's no need to fetch it since it doesn't exist
    return !reportMetadata?.isOptimisticReport && !report?.errorFields?.createChat;
}

https://github.com/Expensify/App/blob/9fe5511a6c9502c289c129543a09a4fa5f33f65e/src/libs/shouldFetchReport.ts#L6

if (!shouldFetchReport(report, reportMetadata)) {
    return;
}

https://github.com/Expensify/App/blob/9fe5511a6c9502c289c129543a09a4fa5f33f65e/src/pages/home/ReportScreen.tsx#L487

And here if we create a new report, we should change the method of report metadata to set and move this update to the exist optimistic report meta data instead of creating a new one.

https://github.com/Expensify/App/blob/9fe5511a6c9502c289c129543a09a4fa5f33f65e/src/libs/actions/Report.ts#L958-L963

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

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.

nkdengineer avatar Dec 10 '24 10:12 nkdengineer

@cristipaval @joekaufmanexpensify Please do not mark it as external. @TMisiukiewicz Can you please raise a fix for this?

shubham1206agra avatar Dec 10 '24 11:12 shubham1206agra

@shubham1206agra sure, I'm on it now

TMisiukiewicz avatar Dec 10 '24 11:12 TMisiukiewicz

NAB

cristipaval avatar Dec 10 '24 11:12 cristipaval

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

melvin-bot[bot] avatar Dec 10 '24 11:12 melvin-bot[bot]

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

melvin-bot[bot] avatar Dec 10 '24 11:12 melvin-bot[bot]

PR in review

joekaufmanexpensify avatar Dec 16 '24 15:12 joekaufmanexpensify

As an fyi, I am OOO until the new year. Please ask in slack if anything urgent BZ related comes up. Otherwise, I will handle payment when I return!

joekaufmanexpensify avatar Dec 20 '24 21:12 joekaufmanexpensify

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

melvin-bot[bot] avatar Dec 26 '24 20:12 melvin-bot[bot]

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

  • https://github.com/Expensify/App/pull/53847

If no regressions arise, payment will be issued on 2025-01-02. :confetti_ball:

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

  • @TMisiukiewicz does not require payment (Contractor)
  • @shubham1206agra requires payment (Needs manual offer from BZ)

melvin-bot[bot] avatar Dec 26 '24 20:12 melvin-bot[bot]

@shubham1206agra @joekaufmanexpensify @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[bot] avatar Dec 26 '24 20:12 melvin-bot[bot]

OOO this week, will close this out early next week. @shubham1206agra please handle the checklist in the meantime if you can. Thanks!

joekaufmanexpensify avatar Dec 30 '24 16:12 joekaufmanexpensify

Payment Summary

Upwork Job

  • Contributor: @TMisiukiewicz is from an agency-contributor and not due payment
  • ROLE: @shubham1206agra paid $(AMOUNT) via Upwork (LINK)

BugZero Checklist (@joekaufmanexpensify)

  • [ ] I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
  • [ ] I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1866441003573597899/hired)
  • [ ] I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • [ ] I have verified the payment summary above is correct

melvin-bot[bot] avatar Jan 02 '25 09:01 melvin-bot[bot]

BugZero Checklist:

  • [x] [Contributor] Classify the bug:
Bug classification

Source of bug:

  • [ ] 1a. Result of the original design (eg. a case wasn't considered)
  • [x] 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)
  • [x] 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
  • [x] 3d. QA
  • [ ] 3z. Other:
  • [x] [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/53203#issuecomment-2569584090

  • [x] [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

  • [x] [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:

Not Required as this was a deploy blocker, and is already present in Test Rail.

Do we agree 👍 or 👎

shubham1206agra avatar Jan 03 '25 17:01 shubham1206agra

TY! Will handle remaining steps today.

joekaufmanexpensify avatar Jan 06 '25 15:01 joekaufmanexpensify

Checklist is all set.

joekaufmanexpensify avatar Jan 06 '25 16:01 joekaufmanexpensify

@shubham1206agra I don't think any payment is required here as this was fixing a deploy blocker which originated from a PR you reviewed. Let me know if you disagree with that. Going to close this in the interim as this is otherwise all set.

joekaufmanexpensify avatar Jan 06 '25 16:01 joekaufmanexpensify