Skip to content

[Due for payment 2026-06-22] [Due for payment 2026-06-19] Distance - Selection mode exits after entering search term that does not return result #93360

Closed

Description

@applause-bot

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.4.6-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: #90920
Email or phone of affected tester (no customers): jsodinjosdjsoinjsiojs@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.5 / Chrome
App Component: Money Requests

Action Performed:

Precondition:

  • Enable Distance rates.
  • Have at least 12 distance rates.
  1. Launch Expensify app.
  2. Go to workspace settings > Distance rates.
  3. Long tap on any rate > Select.
  4. Tap on the search field.
  5. Type anything that will not return result.

Expected Result:

Selection mode will persist.

Actual Result:

Selection mode exits after entering search term that does not return result.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7178410_1781223590946.ScreenRecording_06-12-2026_08-18-04_1.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Mita Rachim
Bug ID: 7178410

Issue OwnerCurrent Issue Owner: @Krishna2323

Activity

  1. added
    DeployBlockerCash
    Bug
    on Jun 12, 2026
  2. applause-bot commented on Jun 12, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/6c54820e0d3c1b62342594a2c7cae3120b0761cf2c482900968d10b411ee5d75

  3. melvin-bot commented on Jun 12, 2026

    @melvin-bot

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

  4. melvin-bot commented on Jun 12, 2026

    @melvin-bot

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

  5. github-actions commented on Jun 12, 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 Jun 12, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    The new distance-rates table (added in #90920) feeds the search-filtered data into the selection middleware. When a search returns zero results, the middleware thinks every row has disappeared and force-exits mobile selection mode.

    In Table.tsx:187, useSelection is given sortedData, which is the output of the filter → search → sort pipeline (Table.tsx:170-187):

    filteredData → searchedData → sortedData → useSelection({ data: sortedData })
    

    Inside the selection middleware, selectableKeys is derived from that already-searched data (selection.ts:52), and this effect turns off selection mode the moment it's empty (selection.ts:64-71):

    // When there are no more items to be selected, turn off selection mode on mobile
    useEffect(() => {
        if (selectableKeys.length || !isSelectionModeEnabled) {
            return;
        }
        turnOffMobileSelectionMode();
    }, [selectableKeys.length, isSelectionModeEnabled]);

    This effect was intended for the "delete the last rate → exit selection mode cleanly" case (Test 4 of #90920). But because selectableKeys reflects the searched/filtered list rather than the underlying data, typing a search term with no matches makes selectableKeys.length === 0 and incorrectly exits selection mode.

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

    Base the "no more selectable items → exit selection mode" decision on the original, unfiltered data, not the search/filter result.

    • Pass the original data's selectable count (or the original data) from Table.tsx into useSelection, separate from the sortedData used for rendering selection state.
    • In the selection.ts:64-71 effect, only call turnOffMobileSelectionMode() when the original selectable count is 0 (i.e. all rates were actually deleted), so an active search/filter that yields no rows no longer collapses selection mode.

    This preserves the intended "delete the last rate" behavior while fixing the regression.

    What alternative solutions did you explore? (Optional)

    Alternatively, gate the effect on whether a search string / filter is active (the parent already computes hasSearchString and hasActiveFilters at Table.tsx:230-231) — skip the turn-off whenever the empty list is the result of an active search/filter rather than an empty dataset. Using the original data count is cleaner because it has a single source of truth.

    Confidence & symptoms covered

    Confidence: High — the data flow is fully traced from the search input to turnOffMobileSelectionMode(), and it explains the exact reported symptom (selection mode exits only when the typed term returns no results; a term that returns results keeps selection mode because selectableKeys.length > 0). The regression matches the PR (#90920) the deploy-blocker bot assigned. All changes are in the App repo, so this is fixable here.


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/93360) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.

  7. added
    Reviewing
    on Jun 12, 2026
  8. Krishna2323 commented on Jun 12, 2026

    @Krishna2323
    Contributor
  9. melvin-bot commented on Jun 12, 2026

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

    If a regression has occurred and you are the assigned CM follow the instructions here.

    If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

  10. JS00001 commented on Jun 12, 2026

    @JS00001
    Contributor

    Tested, this is fixed

  11. removed
    DeployBlockerCash
    Hourly
    on Jun 12, 2026
  12. JS00001 commented on Jun 12, 2026

    @JS00001
    Contributor

    Tested on staging, this is fixed

  13. added
    Daily
    and removed
    Reviewing
    on Jun 12, 2026
  14. changed the title [-]Distance - Selection mode exits after entering search term that does not return result[/-] [+][Due for payment 2026-06-19] Distance - Selection mode exits after entering search term that does not return result[/+] on Jun 12, 2026
  15. melvin-bot commented on Jun 12, 2026

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  16. melvin-bot commented on Jun 12, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.6-4 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-06-19. 🎊

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

    • @Krishna2323 requires payment through NewDot Manual Requests
  17. melvin-bot commented on Jun 12, 2026

    @melvin-bot

    @Krishna2323 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]. If no checklist is needed for this issue, you can click: [no checklist button]

  18. changed the title [-][Due for payment 2026-06-19] Distance - Selection mode exits after entering search term that does not return result[/-] [+][Due for payment 2026-06-22] [Due for payment 2026-06-19] Distance - Selection mode exits after entering search term that does not return result[/+] on Jun 15, 2026
  19. melvin-bot commented on Jun 15, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.7-4 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-06-22. 🎊

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

    • @Krishna2323 requires payment through NewDot Manual Requests
  20. melvin-bot commented on Jun 15, 2026

    @melvin-bot

    @Krishna2323 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]. If no checklist is needed for this issue, you can click: [no checklist button]

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

Metadata

Metadata

Labels

BugDailyEngineering

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions