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

[$250] Expense - In delete expense details page, on tapping header "hold" option is displayed #57702

Open
4 of 8 tasks
lanitochka17 opened this issue Mar 3, 2025 · 16 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@lanitochka17
Copy link

lanitochka17 commented Mar 3, 2025

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.1.8-0
Reproducible in staging?: Y
Reproducible in production?: N
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to https://staging.new.expensify.com/home
  2. Tap fab- create expense
  3. Select a user
  4. Complete the flow
  5. Tap plus icon & create second expense
  6. Open the second expense details page
  7. Enter merchant and description
  8. Send few comments
  9. Rename merchant and description
  10. Send few comments
  11. Tap header - delete expense
  12. Tap header

Expected Result:

In delete expense details page, on tapping header "hold" option must not be displayed

Actual Result:

In delete expense details page, on tapping header "hold" option is displayed

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
Bug6760267_1741034396453.Screenrecorder-2025-03-04-02-00-26-748.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021897001007484700253
  • Upwork Job ID: 1897001007484700253
  • Last Price Increase: 2025-03-04
Issue OwnerCurrent Issue Owner: @thesahindia
@lanitochka17 lanitochka17 added the DeployBlockerCash This issue or pull request should block deployment label Mar 3, 2025
Copy link

melvin-bot bot commented Mar 3, 2025

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

Copy link

melvin-bot bot commented Mar 3, 2025

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

Copy link
Contributor

github-actions bot commented Mar 3, 2025

👋 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.

@lanitochka17
Copy link
Author

Production:

bandicam.2025-03-03.23-45-58-083.mp4

@samranahm
Copy link

samranahm commented Mar 3, 2025

🚨 Edited by proposal-police: This proposal was edited at 2025-03-03 21:22:21 UTC.

Proposal

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

Expense - In delete expense details page, on tapping header "hold" option is displayed

What is the root cause of that problem?

if (isExpenseReport && shouldShowHoldAction) {
result.push(
PromotedActions.hold({
isTextHold: canHoldUnholdReportAction.canHoldRequest,
reportAction: moneyRequestAction,
reportID: transactionThreadReportID ? report.reportID : moneyRequestAction?.childReportID,
isDelegateAccessRestricted,
setIsNoDelegateAccessMenuVisible,
currentSearchHash,

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

We should add another check here !isDeletedParentAction

if (isExpenseReport && shouldShowHoldAction && !isDeletedParentAction) {
result.push(
    PromotedActions.hold({
        isTextHold: canHoldUnholdReportAction.canHoldRequest,
        reportAction: moneyRequestAction,
        reportID: transactionThreadReportID ? report.reportID : moneyRequestAction?.childReportID,
        isDelegateAccessRestricted,
        setIsNoDelegateAccessMenuVisible,
        currentSearchHash,
    }),
);

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

None

What alternative solutions did you explore? (Optional)

Results

Screen.Recording.2025-03-04.at.5.31.18.AM.mov

@aldo-expensify
Copy link
Contributor

Reproduced...

@aldo-expensify
Copy link
Contributor

I was struggling to get my local dev environment to work, but now I'm back.

@aldo-expensify
Copy link
Contributor

This was caused by this: #57219

Thanks @samranahm for the investigation / proposal here: #57702 (comment), I'm just not sure if this is the right way of solving it or if the right way would be to calculate properly the canHoldRequest variable here:

const canHoldRequest = canHoldOrUnholdRequest && !isOnHold && (isRequestIOU || canModifyStatus) && !isScanning;

I'll wait for some feedback from @nkdengineer or @DylanDylann since they worked in this PR: #57219

@DylanDylann
Copy link
Contributor

@nkdengineer @aldo-expensify I don't think this is a regression

In #57219, we remove !!transaction?.reimbursable as an intention because we don't need reimbursable check anymore.

The reason why this bug happens after #57219 is merged: the transaction is an empty object when removed, incidentally canHoldOrUnholdRequest is true after #57219 was merged because previously if the transaction is empty, transaction?.reimbursable will be undefined --> canHoldOrUnholdRequest is false

The root cause analysis of this issue indicates that the isClosed variable fails to update accurately, leading to the discrepancy in canHoldOrUnholdRequest

const isClosed = isClosedReport(moneyRequestReport);

--> canHoldOrUnholdRequest get a wrong value

const canHoldOrUnholdRequest = !isRequestSettled && !isApproved && !isDeletedParentActionLocal && !isClosed;

@daledah
Copy link
Contributor

daledah commented Mar 4, 2025

Proposal

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

In delete expense details page, on tapping header "hold" option is displayed

What is the root cause of that problem?

After deleting expense then transaction = {} and the condition canHoldOrUnholdRequest here will be true

const canHoldOrUnholdRequest = !isRequestSettled && !isApproved && !isDeletedParentActionLocal && !isClosed;

I agree with Dylan here, we are not handling deleted expense case properly. We are checking the isClosed condition for moneyRequestReport but when deleting expense, moneyRequestReport still has statusNum=0 which means it is open => canHoldOrUnholdRequest has a wrong value.

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

We should add !isEmptyObject(transaction) to this condition to handle case delete expense

    const canHoldOrUnholdRequest = !isRequestSettled && !isApproved && !isDeletedParentActionLocal && !isClosed && !isEmptyObject(transaction);

const canHoldOrUnholdRequest = !isRequestSettled && !isApproved && !isDeletedParentActionLocal && !isClosed;

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

None

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.

@aldo-expensify aldo-expensify added Daily KSv2 and removed Hourly KSv2 Daily KSv2 DeployBlockerCash This issue or pull request should block deployment labels Mar 4, 2025
@aldo-expensify
Copy link
Contributor

Per this conversation https://expensify.slack.com/archives/C01GTK53T8Q/p1741103259022879?thread_ts=1741035374.734509&cid=C01GTK53T8Q, demoting this to non-deploy blocker since this doesn't seem very important.

@aldo-expensify
Copy link
Contributor

The root cause analysis of this issue indicates that the isClosed variable fails to update accurately, leading to the discrepancy in canHoldOrUnholdRequest

If this is true, then I feel like we should be making sure we are not reading a stale moneyRequestReport or something. I'll debug a bit more.

@aldo-expensify aldo-expensify added the External Added to denote the issue can be worked on by a contributor label Mar 4, 2025
@melvin-bot melvin-bot bot changed the title Expense - In delete expense details page, on tapping header "hold" option is displayed [$250] Expense - In delete expense details page, on tapping header "hold" option is displayed Mar 4, 2025
Copy link

melvin-bot bot commented Mar 4, 2025

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 4, 2025
@aldo-expensify aldo-expensify added Bug Something is broken. Auto assigns a BugZero manager. and removed Help Wanted Apply this label when an issue is open to proposals by contributors labels Mar 4, 2025
Copy link

melvin-bot bot commented Mar 4, 2025

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

Copy link

melvin-bot bot commented Mar 4, 2025

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

@aldo-expensify
Copy link
Contributor

The root cause analysis of this issue indicates that the isClosed variable fails to update accurately, leading to the discrepancy in canHoldOrUnholdRequest

If this is true, then I feel like we should be making sure we are not reading a stale moneyRequestReport or something. I'll debug a bit more.

@DylanDylann moneyRequestReport is the iou containing the 2 transactions (the one deleted and the one that has not been deleted), so it is correct that isClosedReport(moneyRequestReport) is returning false.

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

No branches or pull requests

7 participants