Skip to content

[Due for payment 2026-01-07] Applied filters are in empty state after resetting filters and closing RHP without saving it #77992

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.81-5
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #77673
Email or phone of affected tester (no customers): sjdnisnjosjoisnjsiod@gmail.com
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Mac 26.1 / Chrome
App Component: Search

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to Reports > Expenses.
  3. Click Filters.
  4. Click From.
  5. Select any user > Save.
  6. Click View results.
  7. Click Filters.
  8. Click Reset filters.
  9. Close the RHP without saving it.
  10. Click Reset filters.

Expected Result:

From filter should remain applied and Reset filters button will appear because user did not click View results after resetting filters.

Actual Result:

From filter is empty and Reset filters button does not appear when user did not click View results after resetting filters.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @garrettmknight

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Dec 18, 2025
  2. melvin-bot commented on Dec 18, 2025

    @melvin-bot

    Triggered auto assignment to @garrettmknight (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 Dec 18, 2025

    @melvin-bot

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

  4. melvin-bot commented on Dec 18, 2025

    @melvin-bot

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

  5. github-actions commented on Dec 18, 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. nyomanjyotisa commented on Dec 18, 2025

    @nyomanjyotisa
    Member

    Proposal

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

    Applied filters are in empty state after resetting filters and closing RHP without saving it

    What is the root cause of that problem?

    When the user clicks "Reset filters", it directly clears ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM using `clearAdvancedFilters

    function clearAdvancedFilters() {
    const values: Partial<Nullable<SearchAdvancedFiltersForm>> = {};
    for (const key of Object.values(FILTER_KEYS)) {
    switch (key) {
    case FILTER_KEYS.GROUP_BY:
    continue;
    case FILTER_KEYS.COLUMNS:
    continue;
    case FILTER_KEYS.TYPE:
    values[key] = CONST.SEARCH.DATA_TYPES.EXPENSE;
    continue;
    case FILTER_KEYS.STATUS:
    values[key] = CONST.SEARCH.STATUS.EXPENSE.ALL;
    continue;
    default:
    values[key] = null;
    }
    }
    Onyx.merge(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, values);

    The filter form is synced with the current query in SearchPage, but this useEffect only runs when formValues changes, which is derived from queryJSON

    const formValues = queryJSON
    ? buildFilterFormValuesFromQuery(queryJSON, policyCategories, policyTagsLists, currencyList, personalDetails, allCards, allReports, taxRates)
    : getEmptyObject<Partial<SearchAdvancedFiltersForm>>();
    // Sync the advanced filters form with the current query when it changes
    useEffect(() => {
    updateAdvancedFilters(formValues, true);
    }, [formValues]);

    When the user closes the filters RHP without saving, the queryJSON hasn't changed (it's still the applied query), so the useEffect doesn't re-run to restore the filter form values. The form remains in the cleared state from when "Reset filters" was clicked

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

    We could restore the filter form values from the current query when the advanced filters page mounts with a useEffect that sync the form with the current URL query params

        const [policyCategories] = useOnyx(ONYXKEYS.COLLECTION.POLICY_CATEGORIES, {canBeMissing: true});
        const [policyTagsLists] = useOnyx(ONYXKEYS.COLLECTION.POLICY_TAGS, {canBeMissing: true});
        const [currencyList] = useOnyx(ONYXKEYS.CURRENCY_LIST, {canBeMissing: true});
        const personalDetails = usePersonalDetails();
        const [userCardList] = useOnyx(ONYXKEYS.CARD_LIST, {canBeMissing: false});
        const [workspaceCardFeeds] = useOnyx(ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST, {canBeMissing: false});
        const allCards = useMemo(() => mergeCardListWithWorkspaceFeeds(workspaceCardFeeds ?? CONST.EMPTY_OBJECT, userCardList, true), [userCardList, workspaceCardFeeds]);
        const [allReports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {canBeMissing: true});
        const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: true});
        const taxRates = useMemo(() => getAllTaxRates(policies), [policies]);
    
        useEffect(() => {
            const queryJSON = getCurrentSearchQueryJSON();
            if (!queryJSON) {
                return;
            }
    
            const formValues = buildFilterFormValuesFromQuery(queryJSON, policyCategories, policyTagsLists, currencyList, personalDetails, allCards, allReports, taxRates);
            updateAdvancedFilters(formValues, true);
            // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
        }, []);

    What alternative solutions did you explore? (Optional)

    None

  7. 15 remaining items

  8. changed the title [-]Applied filters are in empty state after resetting filters and closing RHP without saving it[/-] [+][Due for payment 2026-01-07] Applied filters are in empty state after resetting filters and closing RHP without saving it[/+] on Dec 31, 2025
  9. melvin-bot commented on Dec 31, 2025

    @melvin-bot

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

  10. melvin-bot commented on Dec 31, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.89-6 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-01-07. 🎊

  11. melvin-bot commented on Dec 31, 2025

    @melvin-bot

    @luacmartins / @JS00001 @garrettmknight 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]

  12. brunovjk commented on Jan 6, 2026

    @brunovjk
    Contributor

    BugZero Checklist:

    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment:

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion:

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    Regression Test Proposal

    Test:

    1. Go to Reports > Expenses.
    2. Click Filters.
    3. Click From.
    4. Select any user > Save.
    5. Click View results.
    6. Click Filters.
    7. Click Reset filters.
    8. Close the RHP without saving it.
    9. Click Reset filters.
    10. From filter should remain applied and Reset filters button will appear because user did not click View results after resetting filters.

    Do we agree 👍 or 👎

  13. added and removed on Jan 6, 2026
  14. garrettmknight commented on Jan 7, 2026

    @garrettmknight
    Contributor

    Payment summary:

  15. twisterdotcom commented on Jan 8, 2026

    @twisterdotcom
    Contributor

    @brunovjk has submitted payment for this report on ND here.

    SO: https://stackoverflowteams.com/c/expensify/questions/7582

    Zapier Logs Run ID: 00040eee-d850-a818-5548-b3aaeb260924
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.DailyKSv2Engineering

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions