Skip to content

Reports - Newly added category is not selected with bulk select #80691

Closed

Description

@vincdargento

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.10-1
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #80333
Email or phone of affected tester (no customers): gibethlehem@gmail.com
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: macOS/chrome
App Component: Other

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Create some expenses with different category for the first time
  4. Navigate to the Reports page > Group by category
  5. Bulk Select

Expected Result:

"Bulk Select" selects all the category rows

Actual Result:

"Bulk Select" selects only the ones that have been interacted with

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

bug.mov

View all open jobs on GitHub

Activity

  1. melvin-bot commented on Jan 27, 2026

    @melvin-bot

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

  2. melvin-bot commented on Jan 27, 2026

    @melvin-bot

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

  3. github-actions commented on Jan 27, 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.
  4. OSBotify commented on Jan 27, 2026

    @OSBotify
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: #80333 - "feat: [Insights] [Release 1] Top Categories - Add group-by:category" by @TaduJR (High confidence)
    Related Issues: N/A

    Recommendation: REVERT

    PR #80333 introduced the groupBy:category feature but contains a critical bug in the bulk select functionality. The bulk select feature only works for categories whose transactions have already been loaded (expanded), leaving newly created categories unselectable.

    Labels: Keeping DeployBlockerCash (App deploy blocker - Frontend bug)

    📋 Detailed Analysis

    Evidence

    The issue states that "Bulk Select" only selects category rows that have been interacted with, not newly added ones. This aligns perfectly with how PR #80333 implemented lazy loading for grouped transactions.

    PR #80333 modified:

    • /src/components/Search/index.tsx - Added category grouping logic
    • /src/libs/SearchUIUtils.ts - Added getCategorySections() function
    • Multiple other files to support the category grouping feature

    Verification

    The affected functionality is in /src/components/Search/index.tsx:

    Lines 458-483: Transactions are loaded lazily from snapshots when groups are expanded:

    const enriched = (baseFilteredData as TransactionGroupListItemType[]).map((item) => {
        const snapshot = item.transactionsQueryJSON?.hash ? groupByTransactionSnapshots[String(item.transactionsQueryJSON.hash)] : undefined;
        if (!snapshot?.data) {
            return item;  // Returns item with empty transactions array
        }
        // ... loads transactions from snapshot
        return {...item, transactions: transactions1 as TransactionListItemType[]};
    });

    Lines 1024-1040: The toggleAllTransactions() function (called by "Bulk Select") tries to select all transactions:

    if (areItemsGrouped) {
        setSelectedTransactions(
            Object.fromEntries(
                (filteredData as TransactionGroupListItemType[]).flatMap((item) =>
                    item.transactions  // BUG: Empty array for unexpanded categories!
                        .filter((t) => !isTransactionPendingDelete(t))
                        .map((transactionItem) => {
                            // ... selection logic
                        }),
                ),
            ),
            filteredData,
        );
    }

    Lines 2188-2194 in /src/libs/SearchUIUtils.ts: Categories are initialized with empty transaction arrays:

    categorySections[key] = {
        groupedBy: CONST.SEARCH.GROUP_BY.CATEGORY,
        transactions: [],  // Empty until expanded!
        transactionsQueryJSON,
        ...categoryGroup,
        formattedCategory,
    };

    Root Cause

    When a user creates new expenses with categories and navigates to Reports > Group by category, the category groups are created with empty transactions arrays. The transactions are only loaded from snapshots when the user expands a category group.

    When "Bulk Select" is clicked, the toggleAllTransactions() function iterates through all category groups and attempts to select item.transactions. For unexpanded categories, this array is empty, so no transactions get selected even though they exist in the backend data.

    Categories that have been "interacted with" (expanded) work correctly because their transactions have already been loaded from the snapshot into the item.transactions array.

  5. neil-marcellini commented on Jan 27, 2026

    @neil-marcellini
    Contributor

    Chatted with @trjExpensify and he said this is how bulk select should work with group by, due to performance limitations with the current design. Not new nor an issue at this point.

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

Metadata

Metadata

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions