Skip to content

[$250] Reports - "Delete" option is missing when offline #79682

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: v9.3.2-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #75261
Email or phone of affected tester (no customers): Any new account
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Macbook Pro 2023 / Sequoia 15.2
App Component: Chat Report View

Action Performed:

  1. Access www.staging.new.expensify.com
  2. Go to Reports > Reports > Create an empty Report and click on it
  3. Click on the checkbox and go to options (You can see Delete Option)
  4. Go Offline and click on the expense again

Expected Result:

User should still see delete option

Actual Result:

Option is no longer displayed

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7049467_1768430909736.Recording__3273.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022013233481369388538
  • Upwork Job ID: 2013233481369388538
  • Last Price Increase: 2026-01-26
Issue OwnerCurrent Issue Owner: @dominictb

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jan 15, 2026
  2. melvin-bot commented on Jan 15, 2026

    @melvin-bot

    Triggered auto assignment to @laurenreidexpensify (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. nyomanjyotisa commented on Jan 15, 2026

    @nyomanjyotisa
    Member

    Proposal

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

    Reports - "Delete" option is missing when offline

    What is the root cause of that problem?

    In SearchPage.tsx, the delete option is explicitly filtered out when offline

    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}`];
    const reportActions = currentSearchResults?.data?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`];
    const parentReportAction =
    Object.values(reportActions ?? {}).find(
    (action) => (isMoneyRequestAction(action) ? getOriginalMessage(action)?.IOUTransactionID : undefined) === transaction.transactionID,
    ) ?? selectedTransactions[id].reportAction;
    return canDeleteMoneyRequestReport(parentReport, [transaction], parentReportAction ? [parentReportAction] : []);
    });

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

    Remove the offline check that filters out the delete option in SearchPage.tsx

    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}`];
    const reportActions = currentSearchResults?.data?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`];
    const parentReportAction =
    Object.values(reportActions ?? {}).find(
    (action) => (isMoneyRequestAction(action) ? getOriginalMessage(action)?.IOUTransactionID : undefined) === transaction.transactionID,
    ) ?? selectedTransactions[id].reportAction;
    return canDeleteMoneyRequestReport(parentReport, [transaction], parentReportAction ? [parentReportAction] : []);
    });

    Note: We can apply the same approach to other bulk action options if needed

    What alternative solutions did you explore? (Optional)

    We can show the delete option when offline only for the "Reports > Reports" tab (EXPENSE_REPORT type), while keeping the current behavior (hide delete when offline) for other search tabs

                (queryJSON?.type === CONST.SEARCH.DATA_TYPES.EXPENSE_REPORT || !isOffline) &&
  4. yatin-italy commented on Jan 15, 2026

    @yatin-italy

    Proposal

    Restate the problem this issue is trying to solve.

    • The Delete option disappears for report expenses when the user goes offline.
    • This stops the user from deleting expenses that should be allowed.

    What is the root cause of that problem?

    • Delete visibility is blocked by the offline check.
    • It depends on connectivity instead of delete permission rules.
    const shouldShowDeleteOption =
        !isOffline &&
        selectedTransactionsKeys.every(/* … */);

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

    • Remove the offline check.
    • Decide visibility only from existing delete eligibility logic.
    - const shouldShowDeleteOption =
    -     !isOffline &&
    -     selectedTransactionsKeys.every(/* … */);
    + const shouldShowDeleteOption =
    +     selectedTransactionsKeys.every(/* … */);
  5. changed the title [-]Reports - "Delete" option is missing when offline[/-] [+][$250] Reports - "Delete" option is missing when offline[/+] on Jan 19, 2026
  6. melvin-bot commented on Jan 19, 2026

    @melvin-bot
  7. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jan 19, 2026
  8. melvin-bot commented on Jan 19, 2026

    @melvin-bot

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

  9. marufsharifi commented on Jan 24, 2026

    @marufsharifi

    Proposal

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

    Reports - "Delete" option is missing when offline.

    What is the root cause of that problem?

    The visibility of the Delete bulk action is incorrectly coupled to network availability. and the logic determining whether the Delete option should be shown relies on search result data that may not be available when offline, causing the visibility check to fail and the option to be hidden in this block if code.

    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}`];
    const reportActions = currentSearchResults?.data?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`];
    const parentReportAction =
    Object.values(reportActions ?? {}).find(
    (action) => (isMoneyRequestAction(action) ? getOriginalMessage(action)?.IOUTransactionID : undefined) === transaction.transactionID,
    ) ?? selectedTransactions[id].reportAction;
    return canDeleteMoneyRequestReport(parentReport, [transaction], parentReportAction ? [parentReportAction] : []);
    });
    if (shouldShowDeleteOption) {
    options.push({
    icon: expensifyIcons.Trashcan,
    text: translate('search.bulkActions.delete'),
    value: CONST.SEARCH.BULK_ACTION_TYPES.DELETE,
    shouldCloseModalOnSelect: true,
    onSelected: () => {
    handleDeleteSelectedTransactions();
    },
    });
    }

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

    When transaction data is not available in currentSearchResults, fall back to selectedTransactions, which is available offline. now in this code
    Then when the parent report is not available in search results, fall back to getReportOrDraftReport.
    and by adding this code we ensures the Delete option is displayed only when all selected transactions are valid and deletable, respecting offline behavior and preventing errors.

    diff --git a/src/pages/Search/SearchPage.tsx b/src/pages/Search/SearchPage.tsx
    index 4c37c7e27cf..23fa0bd588b 100644
    --- a/src/pages/Search/SearchPage.tsx
    +++ b/src/pages/Search/SearchPage.tsx
    @@ -933,34 +933,44 @@ function SearchPage({route}: SearchPageProps) {
                 });
             }
     
    -        const shouldShowDeleteOption =
    -            !isOffline &&
    -            selectedTransactionsKeys.every((id) => {
    -                const transaction = currentSearchResults?.data?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${id}`];
    +            const shouldShowDeleteOption = selectedTransactionsKeys.every((id) => {
    +                const transaction =
    +                    currentSearchResults?.data?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${id}`] ??
    +                    selectedTransactions[id];
    +
                     if (!transaction) {
                         return false;
                     }
    +
                     const parentReportID = transaction.reportID;
    -                const parentReport = currentSearchResults?.data?.[`${ONYXKEYS.COLLECTION.REPORT}${parentReportID}`];
    -                const reportActions = currentSearchResults?.data?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`];
    -                const parentReportAction =
    -                    Object.values(reportActions ?? {}).find(
    -                        (action) => (isMoneyRequestAction(action) ? getOriginalMessage(action)?.IOUTransactionID : undefined) === transaction.transactionID,
    -                    ) ?? selectedTransactions[id].reportAction;
    -                return canDeleteMoneyRequestReport(parentReport, [transaction], parentReportAction ? [parentReportAction] : []);
    -            });
    +                const parentReport =
    +                    currentSearchResults?.data?.[`${ONYXKEYS.COLLECTION.REPORT}${parentReportID}`] ??
    +                    getReportOrDraftReport(parentReportID);
     
    -        if (shouldShowDeleteOption) {
    -            options.push({
    -                icon: expensifyIcons.Trashcan,
    -                text: translate('search.bulkActions.delete'),
    -                value: CONST.SEARCH.BULK_ACTION_TYPES.DELETE,
    -                shouldCloseModalOnSelect: true,
    -                onSelected: () => {
    -                    handleDeleteSelectedTransactions();
    -                },
    +                if (!parentReport) {
    +                    return false;
    +                }
    +
    +                return canDeleteMoneyRequestReport(parentReport, [transaction as Transaction], []);
                 });
    -        }
    +
    +
    +    if (shouldShowDeleteOption) {
    +        options.push({
    +            icon: expensifyIcons.Trashcan,
    +            text: translate('search.bulkActions.delete'),
    +            value: CONST.SEARCH.BULK_ACTION_TYPES.DELETE,
    +            shouldCloseModalOnSelect: true,
    +            onSelected: () => {
    +                handleDeleteSelectedTransactions();
    +            },
    +        });
    +    }
    +
    +
    +
    +
    +        // /////////////////
     
             if (options.length === 0) {
                 const emptyOptionStyle = {
    
    ProposalVideo.mp4
  10. melvin-bot commented on Jan 26, 2026

    @melvin-bot

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

  11. dominictb commented on Jan 28, 2026

    @dominictb
    Contributor

    I cannot select an empty report in Search. It's being implemented in #79756 and it would probably fix this issue too. @laurenreidexpensify Let's put this on HOLD.

  12. marufsharifi commented on Jan 28, 2026

    @marufsharifi

    This issue will be fixed by #77110.

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.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions