Skip to content

Reports - Delete option is missing for unreported expense in Reports > Expenses #77752

Closed

Description

@jponikarchuk

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.2.78-6
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #77207
Email or phone of affected tester (no customers): sjnodsjodijsosjdo1@gmail.com
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Mac 26.1 / Chrome
App Component: Money Requests

Action Performed:

Precondition:

  • Account has self DM.
  1. Go to staging.new.expensify.com
  2. Go to self DM.
  3. Create an expense.
  4. Go to Reports > Expenses.
  5. Select the expense via checkbox.
  6. Click dropdown button.

Expected Result:

Delete option should be present.

Actual Result:

Delete option is missing for unreported expense in Reports > Expenses.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

1.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 Dec 16, 2025
  2. melvin-bot commented on Dec 16, 2025

    @melvin-bot

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

  3. melvin-bot commented on Dec 16, 2025

    @melvin-bot

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

  4. melvin-bot commented on Dec 16, 2025

    @melvin-bot

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

  5. github-actions commented on Dec 16, 2025

    @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.
  6. lakchote commented on Dec 16, 2025

    @lakchote
    Contributor
  7. nyomanjyotisa commented on Dec 16, 2025

    @nyomanjyotisa
    Member

    Proposal

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

    Reports - Delete option is missing for unreported expense in Reports > Expenses

    What is the root cause of that problem?

    In SearchPage, when determining whether to show the delete option, we looks up the parent report using the transaction reportID. For unreported expenses, transaction.reportID is CONST.REPORT.UNREPORTED_REPORT_ID (0), so it return early and the delete option is hidden

    const parentReportID = transaction.reportID;
    const parentReport = currentSearchResults?.data?.[`${ONYXKEYS.COLLECTION.REPORT}${parentReportID}`];
    if (!parentReport) {
    return false;

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

    Handle unreported expenses by finding the self-DM report when the transaction reportID is CONST.REPORT.UNREPORTED_REPORT_ID

            const shouldShowDeleteOption =
                !isOffline &&
                selectedTransactionsKeys.every((id) => {
                    const transaction = currentSearchResults?.data?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${id}`];
                    if (!transaction) {
                        return false;
                    }
                    let parentReportID = transaction.reportID;
                    let parentReport = currentSearchResults?.data?.[`${ONYXKEYS.COLLECTION.REPORT}${parentReportID}`];
    
                    if (!parentReport && (parentReportID === CONST.REPORT.UNREPORTED_REPORT_ID || !parentReportID)) {
                        const selfDMReportID = Object.values(allReports ?? {}).find((report) => report?.chatType === CONST.REPORT.CHAT_TYPE.SELF_DM && !report?.parentReportID)?.reportID;
                        // Or use `findSelfDMReportID` instead
                        // const selfDMReportID = findSelfDMReportID();
                        if (selfDMReportID) {
                            parentReportID = selfDMReportID;
                            parentReport = currentSearchResults?.data?.[`${ONYXKEYS.COLLECTION.REPORT}${parentReportID}`] ?? allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${parentReportID}`];
                        }
                    }
                    
                    if (!parentReport) {
                        return false;
                    }
                    const reportActions = currentSearchResults?.data?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`];
                    const parentReportAction = Object.values(reportActions ?? {}).find(
                        (action) => (isMoneyRequestAction(action) ? getOriginalMessage(action)?.IOUTransactionID : undefined) === transaction.transactionID,
                    );
                    return canDeleteMoneyRequestReport(parentReport, [transaction], parentReportAction ? [parentReportAction] : []);
                });

    const shouldShowDeleteOption =
    !isOffline &&
    selectedTransactionsKeys.every((id) => {
    const transaction = currentSearchResults?.data?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${id}`];
    if (!transaction) {
    return false;
    }
    const parentReportID = transaction.reportID;
    const parentReport = currentSearchResults?.data?.[`${ONYXKEYS.COLLECTION.REPORT}${parentReportID}`];
    if (!parentReport) {
    return false;
    }
    const reportActions = currentSearchResults?.data?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`];
    const parentReportAction = Object.values(reportActions ?? {}).find(
    (action) => (isMoneyRequestAction(action) ? getOriginalMessage(action)?.IOUTransactionID : undefined) === transaction.transactionID,
    );
    return canDeleteMoneyRequestReport(parentReport, [transaction], parentReportAction ? [parentReportAction] : []);
    });

    What alternative solutions did you explore? (Optional)

    None

  8. eh2077 commented on Dec 16, 2025

    @eh2077
    Contributor

    @DylanDylann Looks like we still need to use both allReports and snapshot (search result) data, see #77207 (comment) as well. Or we can try to fix search result data to include unreported expense data, which seems more clean - search result will be self-sufficient then.

    @luacmartins happy to hear your thoughts on this too!

  9. eh2077 commented on Dec 16, 2025

    @eh2077
    Contributor

    @lakchote Hmm, I'd like to ask for demotion given the impact of this issue is moderate. So, we don't need to rush fixing it and avoid reverting the PR to block subsequent tasks.

  10. lakchote commented on Dec 16, 2025

    @lakchote
    Contributor

    Opening up a revert PR as per this discussion.

  11. lakchote commented on Dec 16, 2025

    @lakchote
    Contributor

    Unassigning since no work was done to fix the issue,

    Revert PR is here: #77787

  12. m-natarajan commented on Dec 16, 2025

    @m-natarajan

    Not reproduce, MacOS Monterey / Chrome, Web and Xiaomi Redmi Note 10 / Android 12 v9.2.78-8

    Screen.Recording.2025-12-16.at.23.35.38.mp4
    Screenrecorder-2025-12-16-23-41-57-997.mp4
  13. lakchote commented on Dec 18, 2025

    @lakchote
    Contributor

    Closing since it's not reproducible anymore.

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

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions