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-12-19] [$250] Invoices - Workspace avatar changes briefly after invoice receiver deletes workspace #51130

Open
5 of 8 tasks
IuliiaHerets opened this issue Oct 19, 2024 · 50 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 Overdue

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Oct 19, 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.51-1
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: applausetester [email protected]
Issue reported by: Applause Internal Team

Action Performed:

Precondition:

  • Invoice receiver does not have workspace.
  • Invoice receiver has received an invoice.
  1. Go to staging.new.expensify.com
  2. Go to invoice report.
  3. Click on the invoice preview.
  4. Click Pay button.
  5. Pay the invoice as a business.
  6. Go back to the main invoice room.
  7. Go to workspace settings.
  8. Delete the workspace.
  9. Go back to the main invoice room.

Expected Result:

The workspace avatar of the invoice receiver will not disappear after the workspace is deleted.

Actual Result:

The workspace avatar at the top of the report disappears then reappears after the workspace is deleted.
The workspace avatar of the invoice preview changes to a different avatar and then back to the original avatar.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6639654_1729343016570!Screenshot_2024-10-19_at_21 01 21
Bug6639654_1729343016570.20241019_205303.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021848544462980755973
  • Upwork Job ID: 1848544462980755973
  • Last Price Increase: 2024-10-29
  • Automatic offers:
    • aimane-chnaif | Reviewer | 104739979
    • daledah | Contributor | 104739980
Issue OwnerCurrent Issue Owner: @johncschuster
@IuliiaHerets IuliiaHerets added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 19, 2024
Copy link

melvin-bot bot commented Oct 19, 2024

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

@IuliiaHerets
Copy link
Author

We think that this bug might be related to #vip-bills

@IuliiaHerets
Copy link
Author

@johncschuster FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@daledah
Copy link
Contributor

daledah commented Oct 21, 2024

Edited by proposal-police: This proposal was edited at 2024-10-21 10:04:21 UTC.

Proposal

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

The workspace avatar at the top of the report disappears then reappears after the workspace is deleted.
The workspace avatar of the invoice preview changes to a different avatar and then back to the original avatar.

What is the root cause of that problem?

There're 2 problems:

  1. Invoices - Workspace avatar changes briefly after invoice receiver deletes workspace

After deleting the WS, BE will update it to null in Onyx

When users go to invoice chat, we need to get the avatar of that policy in

App/src/libs/ReportUtils.ts

Lines 2337 to 2339 in 44f5c5c

const receiverPolicyID = report?.invoiceReceiver?.policyID;
const receiverPolicy = invoiceReceiverPolicy ?? getPolicy(receiverPolicyID);
if (!isEmptyObject(receiverPolicy)) {

but it's just available when OpenReport API returns that policy data so we can see the blink problem

  1. Users delete WS in offline mode, we can see the duplicate WS image
Screen.Recording.2024-10-21.at.16.27.32.mov

After deleting the WS, we update the policyName is empty and oldPolicy is deletedWS in

oldPolicyName: allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${policyID}`]?.name ?? '',
policyName: '',

So the first icon is deleted WS avatar (getPolicyName returns report.oldPolicyName)

const policyName = finalPolicy?.name || report?.policyName || report?.oldPolicyName || parentReport?.oldPolicyName || noPolicyFound;

And the second one is receiverPolicy avatar that has the same name with deleted WS

If users go online again, BE will return the correct policyName and oldPolicyName

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

  1. We should update BE to return the default WS same as what OpenReport API returns, and update the optimistic data for deleted WS in this case if needed
Screenshot 2024-10-21 at 16 38 47
  1. We shouldn't set policyName to empty if it's invoice report in here same as what OpenReport API returns
reportsToArchive.forEach((report) => {
        let isInvoiceReport = false;
        if(report?.invoiceReceiver?.policyID === policyID){
            isInvoiceReport = true
        }

        ...
                stateNum: CONST.REPORT.STATE_NUM.APPROVED,
                statusNum: CONST.REPORT.STATUS_NUM.CLOSED,
                private_isArchived: currentTime,
                ...(isInvoiceReport ? {}: {
                    policyName: '',
                    oldPolicyName: allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${policyID}`]?.name ?? '',
                })
            },
        });

What alternative solutions did you explore? (Optional)

@melvin-bot melvin-bot bot added the Overdue label Oct 21, 2024
@johncschuster johncschuster added the External Added to denote the issue can be worked on by a contributor label Oct 22, 2024
Copy link

melvin-bot bot commented Oct 22, 2024

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

@melvin-bot melvin-bot bot changed the title Invoices - Workspace avatar changes briefly after invoice receiver deletes workspace [$250] Invoices - Workspace avatar changes briefly after invoice receiver deletes workspace Oct 22, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 22, 2024
Copy link

melvin-bot bot commented Oct 22, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Oct 22, 2024
@aimane-chnaif
Copy link
Contributor

bug.mp4

@daledah there's still bug (check above video around 38s after making online from offline) after applying your solution which fixes Users delete WS in offline mode, we can see the duplicate WS image. Can we also fix that?

And I am not able to reproduce the first bug - Invoices - Workspace avatar changes briefly after invoice receiver deletes workspace

@daledah
Copy link
Contributor

daledah commented Oct 23, 2024

@aimane-chnaif You mean the avatar order, right?

@aimane-chnaif
Copy link
Contributor

@aimane-chnaif You mean the avatar order, right?

right. and order of workspace names as well

@daledah
Copy link
Contributor

daledah commented Oct 23, 2024

@aimane-chnaif We have the logic to reverse the icons here

if (ReportUtils.isInvoiceRoom(report) && ReportUtils.isCurrentUserInvoiceReceiver(report)) {
icons = [...icons].reverse();
}

It's added on purpose. Do you think we need to fix it?

@aimane-chnaif
Copy link
Contributor

@daledah another question:

We shouldn't set policyName to empty if it's invoice report

If it's not invoice report, why can't we remove setting policyName?

@daledah
Copy link
Contributor

daledah commented Oct 29, 2024

@aimane-chnaif It's added in #38376 and the author want to reset it to match with BE's result #37759 (comment)

@daledah
Copy link
Contributor

daledah commented Oct 29, 2024

I think Invoice report and other one have the different behavior

Copy link

melvin-bot bot commented Oct 29, 2024

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

@aimane-chnaif
Copy link
Contributor

And I am not able to reproduce the first bug - Invoices - Workspace avatar changes briefly after invoice receiver deletes workspace

@daledah can you?

@daledah
Copy link
Contributor

daledah commented Oct 30, 2024

Yes, I still can reproduce @aimane-chnaif

Screen.Recording.2024-10-30.at.21.46.22.mov

@aimane-chnaif
Copy link
Contributor

@daledah's proposal looks good to me.
🎀👀🎀 C reviewed

Copy link

melvin-bot bot commented Oct 31, 2024

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

Copy link

melvin-bot bot commented Nov 2, 2024

@cead22 @johncschuster @aimane-chnaif 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!

@daledah
Copy link
Contributor

daledah commented Nov 26, 2024

@cead22 Yes, I suppose so. I'll add the optimistic and failure data for deleteWorkspace in the PR as well.
Actually we don't need to change anything, optimistic data is correct.

@cead22
Copy link
Contributor

cead22 commented Nov 27, 2024

@daledah I have the back end PR ready, but I can't reproduce the issue anymore. Can you?

@daledah
Copy link
Contributor

daledah commented Nov 28, 2024

@cead22 I'm still able to reproduce:

Screen.Recording.2024-11-28.at.15.37.21.mp4

@daledah
Copy link
Contributor

daledah commented Dec 3, 2024

@cead22 friendly bump

@cead22
Copy link
Contributor

cead22 commented Dec 3, 2024

Thanks, the backend PR is in review

@cead22
Copy link
Contributor

cead22 commented Dec 4, 2024

Backend PR is merged and should be deployed by EOD

@daledah
Copy link
Contributor

daledah commented Dec 6, 2024

Looks like the first problem in my proposal is fixed after the BE change:

Screen.Recording.2024-12-06.at.16.57.11.mov

@cead22
Copy link
Contributor

cead22 commented Dec 6, 2024

@daledah the video isn't showing for me, but that's good news! Can you merge main into your App PR, test again, and remove the hold? cc @dominictb since you're the reviewer

@cead22 cead22 moved this to Done in [#whatsnext] #billpay Dec 10, 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 Dec 12, 2024
@melvin-bot melvin-bot bot changed the title [$250] Invoices - Workspace avatar changes briefly after invoice receiver deletes workspace [HOLD for payment 2024-12-19] [$250] Invoices - Workspace avatar changes briefly after invoice receiver deletes workspace Dec 12, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Dec 12, 2024
Copy link

melvin-bot bot commented Dec 12, 2024

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

Copy link

melvin-bot bot commented Dec 12, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.74-8 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-12-19. 🎊

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

Copy link

melvin-bot bot commented Dec 12, 2024

@cead22 @johncschuster @daledah 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]

@johncschuster
Copy link
Contributor

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:

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

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

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

Precondition:

Test:

Do we agree 👍 or 👎

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Dec 18, 2024
@johncschuster
Copy link
Contributor

@daledah can you please complete the BZ Checklist above?

@melvin-bot melvin-bot bot removed the Overdue label Dec 20, 2024
@johncschuster
Copy link
Contributor

Just a heads up, I will be OOO starting December 23 and will be returning January 6th. A handful of folks on the BZ team will be online for a few days in between the 25th and the 1st, but we'll be operating with a skeleton crew. I will be issuing my payments when I return on January 6th. If you would like the payment issued sooner, please post this issue in #expensify-open-source and someone on the team will jump in.

Thank you!

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

melvin-bot bot commented Dec 24, 2024

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

Copy link

melvin-bot bot commented Dec 26, 2024

@cead22, @johncschuster, @daledah Eep! 4 days overdue now. Issues have feelings too...

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 Overdue
Projects
Status: Done
Development

No branches or pull requests

6 participants