Skip to content

Reports - Filters are still applied after being cleared and returning to the same section. #82101

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.17.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: https://test-management.browserstack.com/projects/2219752/test-runs/TR-4999/folder/13176922/41237512/1183038400
Email or phone of affected tester (no customers): ibellicotest+2250@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Motorola MotoG60 / Android 12 (Hybrid app) - Windows 11 / Chrome
App Component: Search

Action Performed:

  1. Open the staging.new.expensify.com website.
  2. Open any DM. (For example: Self DM)
  3. Send a message.
  4. Tap on the search icon and select the option to search within the chat.
  5. Search for the sent message.
  6. Once redirected to results, use device´s back button to return to chat,
  7. Navigate to "Reports"
  8. Note that you land on "Chats" with the search still applied.
  9. Tap on "Filters" > "Reset Filters" > "View Results"
  10. Note that filters are cleared and you land on "Expenses"
  11. Return to "Chats"
  12. Note that cleared filters are still applied despite being cleared.

Expected Result:

After clearing filters, it shouldn´t be reapplied when returning to the same section.

Actual Result:

After clearing filters and returning to the same section, filters are still applied.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7074479_1770803918795.Applied.mp4

View all open jobs on GitHub

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    DeployBlockerIndicates it should block deploying the API
    on Feb 11, 2026
  2. melvin-bot commented on Feb 11, 2026

    @melvin-bot

    Triggered auto assignment to @joekaufmanexpensify (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 Feb 11, 2026

    @melvin-bot

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

  4. melvin-bot commented on Feb 11, 2026

    @melvin-bot

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

  5. github-actions commented on Feb 11, 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. joekaufmanexpensify commented on Feb 11, 2026

    @joekaufmanexpensify
    Contributor

    Hm, yeah this is only happening on staging. Not a huge issue, but we should definitely fix it.

  7. OSBotify commented on Feb 11, 2026

    @OSBotify
    Contributor

    Investigation Summary

    Classification: Frontend bug
    Causing PR: #80247 - "Fix/79139 - Add sticky filters to the reports page" by @dmkt9 (High confidence)
    Related Issues: #79139

    Recommendation: REVERT

    PR #80247 introduces a sticky filters feature that persists filter values across different search types (Expenses/Reports/Chats). However, it uses module-level state that is not properly synchronized with the Onyx store when filters are reset.

    The root cause is that useStickySearchFilters maintains persistent state in module-level variables (allSearchAdvancedFilters and prevSearchAdvancedFiltersFormsByType) that survive component unmounts and are not cleared when clearAdvancedFilters() resets the Onyx data. When users navigate between search types after clearing filters, the stale cached values are reapplied.

    Labels: Keeping DeployBlockerCash (blocks App deploy). Removing DeployBlocker as this is a frontend-only bug that requires changes to the App repository.

    Detailed Analysis

    Evidence

    Verification

    The PR modifies the following files related to the bug:

    • /home/runner/_work/App/App/src/hooks/useStickySearchFilters.ts (NEW) - Introduces module-level state for sticky filters
    • /home/runner/_work/App/App/src/libs/SearchUIUtils.ts - Adds updateQueryStringOnSearchTypeChange() function
    • /home/runner/_work/App/App/src/pages/Search/SearchTypeMenu.tsx - Applies sticky filters on navigation
    • /home/runner/_work/App/App/src/hooks/useSearchTypeMenu.tsx - Integrates sticky filters hook

    Root Cause

    The useStickySearchFilters hook uses module-level variables to cache filter state:

    const allSearchAdvancedFilters: {current: Partial<SearchAdvancedFiltersForm>} = {current: {}};
    const prevSearchAdvancedFiltersFormsByType: {current: Record<string, Partial<SearchAdvancedFiltersForm> | undefined>} = {current: {}};

    When clearAdvancedFilters() is called in /home/runner/_work/App/App/src/libs/actions/Search.ts, it updates the Onyx store via:

    Onyx.merge(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, values);

    However, the module-level cache in useStickySearchFilters is never cleared. On the next navigation between search types (step 11 in reproduction: "Return to Chats"), the hook reads from its stale cache and reapplies the supposedly-cleared filters via updateQueryStringOnSearchTypeChange().

    The bug manifests because:

    1. User applies filters on "Chats"
    2. Module-level cache stores these filters
    3. User clicks "Reset Filters" - only Onyx is updated, cache remains
    4. User navigates to "Expenses" then back to "Chats"
    5. Hook reads from stale cache and reapplies cleared filters
  8. lakchote commented on Feb 11, 2026

    @lakchote
    Contributor

    cc @dmkt9 seems to be coming from #80247

  9. m-natarajan commented on Feb 11, 2026

    @m-natarajan

    Not repro,Windows 11 / Chrome, v9.3.17-5 and Not repro, Samsung A52 / Android 14 v9.3.17-5, but in step 7 when navigating to "Reports", the filter is auto reset.

    filter.andro.mp4
    filter.mp4
  10. self-assigned this
    on Feb 11, 2026
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.EngineeringHourlyKSv2ReviewingHas a PR in review

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions