Skip to content

[Due for payment 2026-03-13] [$250] Web - Chat - App freezes while creating a chat group #83976

Closed

Description

@mitarachim

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.28-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: #81869
Email or phone of affected tester (no customers): applausetester+030226dr81869@applause.expensifail.com
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: MacOS 26.3 / Safari, Chrome
App Component: Chat Report View

Action Performed:

  1. Login to staging.new.expensify with Expensifail account
  2. Click on "+" button
  3. Select "Start Chat"
  4. Select some users and add them to the chat group
  5. Click Next
  6. On the Group page try to go back, remove any selected member or click "Start Group"

Expected Result:

User can go back, remove any selected member or click "Start Group" on the Group page while creating a chat group

Actual Result:

App freezes on the Group page while creating a chat group. User can not go back, remove any selected member or click "Start Group".

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7092415_1772496310224.Web-App-freeze-chat-group.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @kadiealexander
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022028664996012386335
  • Upwork Job ID: 2028664996012386335
  • Last Price Increase: 2026-03-03

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    DeployBlockerIndicates it should block deploying the API
    on Mar 3, 2026
  2. melvin-bot commented on Mar 3, 2026

    @melvin-bot

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

  3. melvin-bot commented on Mar 3, 2026

    @melvin-bot

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

  4. melvin-bot commented on Mar 3, 2026

    @melvin-bot

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

  5. github-actions commented on Mar 3, 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.
  6. MelvinBot commented on Mar 3, 2026

    @MelvinBot
    Contributor

    Proposal

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

    The app freezes on the Group page when creating a chat group (click "+" → "Start Chat" → select users → click "Next"). The user cannot go back, remove members, or click "Start Group". This was introduced by PR #81869 which migrated NewChatPage from the old SectionList-based SelectionList to the new FlashList-based SelectionListWithSections.

    What is the root cause of that problem?

    PR #81869 changed useFilteredOptions.ts in two ways that combine to create a runaway re-render loop:

    1. Removed the data-driven guard from loadMore (useFilteredOptions.ts:102-108). Previously, loadMore checked options.reports.length < totalReports before incrementing the limit. Now it only checks isLoadingMore, which resets to false after just one render cycle via the useEffect at line 95-100.

    2. Changed hasMore to use reportsLimit < totalReports (line 110). totalReports counts ALL Onyx report collection keys (Object.keys(allReports).length at line 82), including null/empty entries. This creates a large gap between reportsLimit (starts at 500) and totalReports (could be thousands).

    The loop works like this:

    1. FlashList fires onEndReached (content doesn't fill the viewport, or data changes trigger a layout recalculation)
    2. handleEndReached at NewChatPage.tsx:205-210 checks guards: hasMore is true (reportsLimit < totalReports), isLoadingMore is false → calls loadMore()
    3. loadMore sets isLoadingMore=true and increments reportsLimit by 100
    4. React re-renders, running createFilteredOptionList (expensive — sorts ALL reports and processes up to reportsLimit)
    5. The useEffect sees options changed and isLoadingMore is true → sets isLoadingMore=false
    6. Another re-render occurs. FlashList gets new data, recalculates layout, fires onEndReached again
    7. handleEndReached: hasMore still true (reportsLimit 600 < totalReports 5000), isLoadingMore now false → calls loadMore() again
    8. GOTO step 3 — repeats with reportsLimit 700, 800, 900... until reportsLimit >= totalReports

    For a user with thousands of report keys, this means ~45+ iterations of expensive createFilteredOptionList calls in rapid succession, blocking the main thread and freezing the UI. The freeze manifests on the Group page because NewChatPage is still mounted in the stack navigator and continues processing.

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

    In src/hooks/useFilteredOptions.ts, restore a data-driven guard that stops loading when all valid reports have been loaded. The loadMore function should check whether the current options actually filled up to the limit — if options.reports.length < reportsLimit, it means filtering has exhausted all valid reports and there's nothing more to load:

    const loadMore = () => {
        if (!options || isLoadingMore) {
            return;
        }
        // If current results don't fill the limit, all valid reports are already loaded
        if (options.reports.length < reportsLimit) {
            return;
        }
        setIsLoadingMore(true);
        setReportsLimit((prev) => prev + batchSize);
    };
    

    Also update hasMore to be consistent with this guard so the loading indicator behaves correctly:

    const hasMore = options ? options.reports.length >= reportsLimit && reportsLimit < totalReports : false;
    

    What alternative solutions did you explore? (Optional)

    • Debouncing/throttling loadMore: Would reduce the frequency but not eliminate the root cause. The loop would still run, just more slowly.
    • Reverting the hasMore change entirely: Going back to options.reports.length < totalReports would work but could lead to edge cases where filtering causes hasMore to always be true (if filtered count never reaches total). The proposed fix is more robust.
    • Keeping isLoadingMore true longer (e.g., resetting it in requestAnimationFrame instead of useEffect): Would add a delay but is fragile and doesn't address the fundamental issue that loadMore runs without checking if more data is actually available.

    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.

  7. 12 remaining items

  8. blimpich commented on Mar 3, 2026

    @blimpich
    Contributor

    Going forward with reverting this

  9. blimpich commented on Mar 3, 2026

    @blimpich
    Contributor
  10. m-natarajan commented on Mar 3, 2026

    @m-natarajan

    The issue is no longer reproducible on Windows 11, Chrome. Build v9.3.28-8

    explorer_3VKSsoeV2P.mp4
  11. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Mar 6, 2026
  12. changed the title [-][$250] Web - Chat - App freezes while creating a chat group[/-] [+][Due for payment 2026-03-13] [$250] Web - Chat - App freezes while creating a chat group[/+] on Mar 6, 2026
  13. melvin-bot commented on Mar 6, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.31-12 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-03-13. 🎊

    For reference, here are some details about the assignees on this issue:

  14. melvin-bot commented on Mar 6, 2026

    @melvin-bot

    @parasharrajat @kadiealexander The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  15. melvin-bot commented on Mar 6, 2026

    @melvin-bot

    Current assignee @kadiealexander is eligible for the Awaiting Payment assigner, not assigning anyone new.

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.EngineeringExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributorsWeeklyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions