Skip to content

Reports - Move expenses button is no longer present in bulk select menu after opening it #73623

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.39-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: Exploratory
Email or phone of affected tester (no customers): jdsojsnoisjo@gmail.com
Issue reported by: Applause Internal Team
Device used: Mac 15.5 / Chrome
App Component: Search

Action Performed:

Precondition:

  • Account has self DM and workspace.
  1. Go to staging.new.expensify.com
  2. Go to self DM.
  3. Create an expense.
  4. Go to workspace chat.
  5. Create an expense.
  6. Go to Reports > Expenses.
  7. Select both expenses via checkbox.
  8. Click dropdown button > Move expenses.
  9. Close the RHP.
  10. Click dropdown button > Move expenses.

Expected Result:

Move expenses button will be present.

Actual Result:

Move expenses button is no longer present in bulk select menu after opening it.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6986634_1761640579481.Screen_Recording_2025-10-28_at_16.34.06.mp4

View all open jobs on GitHub

Activity

  1. added
    DeployBlockerCash
    Bug
    on Oct 28, 2025
  2. melvin-bot commented on Oct 28, 2025

    @melvin-bot

    Triggered auto assignment to @NicMendonca (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 Oct 28, 2025

    @melvin-bot

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

  4. melvin-bot commented on Oct 28, 2025

    @melvin-bot

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

  5. github-actions commented on Oct 28, 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. abbasifaizan70 commented on Oct 28, 2025

    @abbasifaizan70
    Contributor

    Proposal: Move expenses button disappears after closing RHP

    Problem Statement

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

    When a user selects multiple expenses on the "Reports > Expenses" page and clicks "Move expenses" from the bulk actions dropdown menu, the RHP (Right-Hand Panel) opens. However, after closing the RHP and clicking the dropdown button again, the "Move expenses" option is no longer present in the bulk select menu, even though the expenses remain selected.


    Root Cause

    What is the root cause of that problem?

    The root cause is in the Search component (src/components/Search/index.tsx). When the RHP closes and the search page regains focus, there's a useEffect hook (starting at line 435) that refreshes the selected transactions metadata to ensure it stays in sync with the current data.

    However, this refresh logic was missing two critical fields when rebuilding the transaction metadata:

    1. isFromOneTransactionReport
    2. ownerAccountID (the critical one for this bug)

    The ownerAccountID field is essential for determining if the selected expenses belong to multiple owners. In useSelectedTransactionsActions.ts (lines 83-124), the hasTransactionsFromMultipleOwners calculation relies on this field to check if expenses have different owners. Without this field in the metadata, the logic cannot properly determine ownership, which causes it to incorrectly hide the "Move expenses" button (line 273 requires !hasTransactionsFromMultipleOwners to be true).

    The bug occurs specifically in two locations in the refresh logic:

    • Lines 454-478: For grouped transactions (when groupBy is set)
    • Lines 492-514: For non-grouped transactions

    Both locations were missing the ownerAccountID field, while the prepareTransactionsList function (line 200) correctly included it.


    Proposed Solution

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

    Add the missing isFromOneTransactionReport and ownerAccountID fields to the transaction metadata refresh logic in both locations in src/components/Search/index.tsx:

    Location 1: Grouped transactions (around line 454-480)

    In the useEffect hook where newTransactionList[transactionItem.transactionID] is built for grouped transactions:

                        newTransactionList[transactionItem.transactionID] = {
                            action: transactionItem.action,
                            canHold: transactionItem.canHold,
                            isHeld: isOnHold(transactionItem),
                            canUnhold: transactionItem.canUnhold,
                            canChangeReport: canEditFieldOfMoneyRequest(
                                transactionItem.reportAction,
                                CONST.EDIT_REQUEST_FIELD.REPORT,
                                undefined,
                                undefined,
                                outstandingReportsByPolicyID,
                                transactionItem,
                                transactionItem.report,
                                transactionItem.policy,
                            ),
                            // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
                            isSelected: areAllMatchingItemsSelected || selectedTransactions[transactionItem.transactionID].isSelected,
                            canDelete: transactionItem.canDelete,
                            reportID: transactionItem.reportID,
                            policyID: transactionItem.policyID,
                            amount: transactionItem.modifiedAmount ?? transactionItem.amount,
                            convertedAmount: transactionItem.convertedAmount,
                            convertedCurrency: transactionItem.convertedCurrency,
                            currency: transactionItem.currency,
    +                       isFromOneTransactionReport: transactionItem.isFromOneTransactionReport,
    +                       ownerAccountID: transactionItem.report?.ownerAccountID ?? transactionItem.accountID,
                        };

    Location 2: Non-grouped transactions (around line 492-514)

    In the same useEffect hook but in the else branch for non-grouped transactions, add the same two fields:

    newTransactionList[transactionItem.transactionID] = {
        action: transactionItem.action,
        canHold: transactionItem.canHold,
        isHeld: isOnHold(transactionItem),
        canUnhold: transactionItem.canUnhold,
        canChangeReport: canEditFieldOfMoneyRequest(...),
        isSelected: areAllMatchingItemsSelected || selectedTransactions[transactionItem.transactionID].isSelected,
        canDelete: transactionItem.canDelete,
        reportID: transactionItem.reportID,
        policyID: transactionItem.policyID,
        amount: transactionItem.modifiedAmount ?? transactionItem.amount,
        convertedAmount: transactionItem.convertedAmount,
        convertedCurrency: transactionItem.convertedCurrency,
        currency: transactionItem.currency,
    +      isFromOneTransactionReport: transactionItem.isFromOneTransactionReport, 
    +     ownerAccountID: transactionItem.report?.ownerAccountID ?? transactionItem.accountID,
    };

    Summary of changes:

    • Add isFromOneTransactionReport field in both locations
    • Add ownerAccountID field in both locations (uses report.ownerAccountID with fallback to accountID)
    • These match the pattern already used in the prepareTransactionsList function (line 200)

    This ensures that when the selection metadata is refreshed (when the page regains focus after closing the RHP), all necessary fields are preserved. The hasTransactionsFromMultipleOwners check will then work correctly, and the "Move expenses" button will remain visible.


    Alternative Solutions

    What alternative solutions did you explore?

    Alternative 1: Don't refresh metadata when page regains focus

    • Considered removing or conditionally skipping the refresh logic entirely
    • Rejected because: The refresh is necessary to keep metadata in sync when data changes (e.g., if a transaction is deleted or modified by another user while the RHP is open)

    Alternative 2: Recalculate ownerAccountID in useSelectedTransactionsActions

    • Considered always recalculating owner information from transactions in the useSelectedTransactionsActions hook instead of relying on cached metadata
    • Rejected because: This would be less efficient and the metadata approach is already working correctly in other code paths (like prepareTransactionsList)

    Demo

    Screen.Recording.2025-10-28.at.4.11.10.PM.mov
  7. self-assigned this
    on Oct 28, 2025
  8. m-natarajan commented on Oct 28, 2025

    @m-natarajan

    Issue not repro in Windows10/Chrome, Iphone 17 Pro/Max/mWeb/Safari and Iphone 17 Pro Max/ios26
    build 9.2.39-1

    Recording.4071.mp4
    0-02-01-29991c826fceea09e5c43aad5c66dcabf5c9fa97537d85808f851e3a2428bca1_f6a5668cc18ed7b1.mp4
    0-02-01-7cec55c5617662383b764a0cc14018e2d07e38f544e7bd0500c4faa59a978113_dadafa0f4495c478.mp4
  9. removed
    DeployBlockerCash
    on Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugEngineeringHourly

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions