Skip to content

Expense - Missing Remove from report option for non-reimbursable expense in retracted report #88424

Closed

Description

@lanitochka17

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.3.61-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #84832
Email or phone of affected tester (no customers): osijdnosijdosjdoij@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.2 / Chrome
App Component: Money Requests

Action Performed:

Precondition:

  • Set Submission to Instantly.
  • Disable Approvals and Payments.
  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Create a non-reimbursable expense.
  4. Open the report.
  5. Click More > Retract.
  6. Click Report field.

Expected Result:

Remove from report option should be shown.

Actual Result:

Remove from report option is missing.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

Bug7134850_1776773903169.5.mp4

View all open jobs on GitHub

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Apr 21, 2026
  2. melvin-bot commented on Apr 21, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #84832

  3. melvin-bot commented on Apr 21, 2026

    @melvin-bot

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

  4. github-actions commented on Apr 21, 2026

    @github-actions
    Contributor

    👋 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.
  5. OSBotify commented on Apr 21, 2026

    @OSBotify
    Contributor

    Investigation Summary

    Classification: Frontend bug
    Causing PR: #84832 - "Fix: Filter ineligible reports in useOutstandingReports hook" by @abzokhattab (High confidence)
    Related Issues: #70423 (the issue PR #84832 was meant to fix)

    Recommendation: REVERT

    PR #84832 introduced a regression where filtering all reports as ineligible causes the "Remove from report" option to be hidden. Reverting is the cleanest fix since the change is contained to useOutstandingReports.ts.

    Assigned: @abzokhattab (PR author), @joekaufmanexpensify, @grgia, @huult (approving reviewers) from highest-confidence causing PR only
    Labels: DeployBlockerCash kept (Frontend bug — App PR caused the issue). No label changes made.

    Detailed Analysis

    Evidence

    • The melvin-bot assigned the issue directly to PR Fix: Filter ineligible reports in useOutstandingReports hook #84832 at the time of filing, and the PR is confirmed in the StagingDeployCash checklist for version 9.3.61-0.
    • PR Fix: Filter ineligible reports in useOutstandingReports hook #84832 modifies src/hooks/useOutstandingReports.ts to filter out reports using isReportIneligibleForMoveExpenses. When the workspace has Instant Submit enabled, Approvals disabled, and Payments disabled, a retracted non-reimbursable expense report is considered ineligible, causing useOutstandingReports to return an empty array.
    • The bug is only reproducible on staging (not production), which is consistent with a recently merged staging-only PR.

    Verification

    • The affected file is src/hooks/useOutstandingReports.ts — directly modified by PR Fix: Filter ineligible reports in useOutstandingReports hook #84832.
    • The consuming component src/pages/iou/request/step/IOURequestEditReportCommon.tsx (line 270) has logic: if (outstandingReports.length === 0 || shouldShowNotFoundPageFromProps) { return true; } for shouldShowNotFoundPage. When outstandingReports is empty (due to the new filter), shouldShowNotFoundPage becomes true, and StepScreenWrapper renders a "Not Found" page instead of the report selection list.
    • The "Remove from report" option is rendered as listFooterContent of the SelectionList (lines 311-319 of IOURequestEditReportCommon.tsx), which is never rendered when the "Not Found" page is shown — even though shouldShowRemoveFromReport (lines 118-123) would otherwise be true.

    Root Cause

    isReportIneligibleForMoveExpenses in ReportUtils.ts (line 2788) returns true for non-draft reports in workspaces with Instant Submit + Submit & Close + only non-reimbursable transactions. After Retract, the report is not in draft state (isDraftReport returns false), so the filter removes it. With no eligible outstanding reports, outstandingReports.length === 0, which triggers the "Not Found" page branch in IOURequestEditReportCommon, hiding the entire list including the "Remove from report" footer option. The fix should either: (a) not show the "Not Found" page when shouldShowRemoveFromReport is true, or (b) ensure the filtering logic correctly handles retracted reports. However, the safest immediate action is to revert PR #84832.

  6. MelvinBot commented on Apr 21, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    PR #84832 added filterEligibleReports in useOutstandingReports.ts which calls isReportIneligibleForMoveExpenses to filter out reports that shouldn't be move targets. For a retracted report under a policy with instant submit + submit-and-close (approvals disabled) containing only non-reimbursable expenses, isReportIneligibleForMoveExpenses returns true — filtering the report out entirely.

    This makes outstandingReports empty in IOURequestEditReportCommon.tsx, which causes shouldShowNotFoundPage to evaluate to true (line ~270), replacing the entire page with a "Not Found" view and hiding the "Remove from report" button that lives in listFooterContent.

    The filter is meant to exclude ineligible destination reports for moving expenses, but it also incorrectly excludes the current/source report the expense already belongs to.

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

    In useOutstandingReports.ts, exclude the currently-selected report from filterEligibleReports so the report the expense is already on always remains in the list. The current report should bypass the eligibility filter since the user isn't "moving" the expense there — they're viewing it to access options like "Remove from report."

    Alternatively, in IOURequestEditReportCommon.tsx, adjust the shouldShowNotFoundPage logic so it does not trigger when shouldShowRemoveFromReport would be true — ensuring the remove option remains accessible even when no other eligible reports exist.

    What alternative solutions did you explore? (Optional)

    Modifying isReportIneligibleForMoveExpenses itself to exclude retracted/open reports was considered, but that would change the semantics of the utility broadly. Scoping the fix to either useOutstandingReports (don't filter the current report) or shouldShowNotFoundPage (don't hide when remove-from-report applies) is more targeted and less risky.

    Supporting evidence
    • isReportIneligibleForMoveExpenses (App/src/libs/ReportUtils.ts:2788-2793): Returns true when isInstantSubmitEnabled(policy) && isSubmitAndClose(policy) && hasOnlyNonReimbursableTransactions(reportID) — exactly matching the bug scenario (Submission=Instantly, Approvals=disabled, non-reimbursable expense).
    • filterEligibleReports (App/src/hooks/useOutstandingReports.ts:25-29): New filter from PR Fix: Filter ineligible reports in useOutstandingReports hook #84832 that removes these reports from the outstanding reports list.
    • shouldShowNotFoundPage (App/src/pages/iou/request/step/IOURequestEditReportCommon.tsx:265-270): Triggers when outstandingReports.length === 0 and no createReportOption exists, replacing the full page.
    • "Remove from report" button (App/src/pages/iou/request/step/IOURequestEditReportCommon.tsx:311-319): Rendered as listFooterContent inside a SelectionList that is a child of FullPageNotFoundView — hidden when shouldShowNotFoundPage is true.
    • shouldShowRemoveFromReport (App/src/pages/iou/request/step/IOURequestEditReportCommon.tsx:118-123): Would evaluate to true for this scenario, but is never reached because the Not Found page replaces all children first.

    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.EngineeringHourlyKSv2ReviewingHas a PR in review

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions