You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-05-20] Spend - Search results appear after resetting filter, navigating to a different tab and back #90073
Version Number: 9.3.69-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/folder/13176922/test-cases/41237516 Email or phone of affected tester (no customers): N/A Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: MacBook Air 15.7.4 Chrome, iPhone 15 iOS 26.3.1 App Component: Search
Action Performed:
Sign in to ND
Create a workspace, add a couple of expenses
Navigate to Spend tab/ Expenses
In the search field type merchant:[anything with no results], apply the filter
Click on the expand button on filter chip, click "Reset"
Open Workspaces tab
Open Spend tab
Expected Result:
Full expenses list is displayed, filter chip does not appear on the page
Actual Result:
After resetting the filter and navigating to a different tab, then back to Spend/ Expenses, the filter and the results appear again on the page
👋 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:
Identify the pull request that introduced this issue and revert it.
Classification: Frontend bug Causing PR: Could not be identified with high confidence — see Detailed Analysis below Related Issues: Similar to #89013 (previously fixed by #89082)
Recommendation: NEEDS INVESTIGATION
The filter chip reappearing after Reset + tab navigation is a known fragile area of the codebase. The fix in PR #89082 (module-level lastSyncedQuerySig in useSearchFilterSync) addressed the same class of bug, but the current report suggests a surviving or re-introduced edge case. The root cause requires hands-on reproduction by someone familiar with the Search filter sync mechanism.
Assigned: @wildan-m (author of PR #88246, the only staging-cycle PR that modifies useSearchFiltersBar.tsx), @joekaufmanexpensify, @dmkt9 (approvers of PR #88246) Labels: DeployBlockerCash label kept — this is a staging-only, App-side bug affecting a core Search UX flow. No label changes made.
Detailed Analysis
Evidence
Bug Summary: After applying a merchant:[no-results] filter via the search input, expanding the filter chip's dropdown popup, and clicking Reset inside the popup, the filter chip initially disappears. However, after navigating to the Workspaces tab and returning to Spend/Expenses, the filter chip and filtered (empty) results reappear.
Platform: iOS native and Windows/Chrome (staging only, not production).
Affected code path:
SearchAdvancedFiltersButton calls useSearchFilterSync(queryJSON, filterFormValues) which syncs the URL-derived queryJSON into the Onyx SEARCH_ADVANCED_FILTERS_FORM key.
useSearchFiltersBar reads from Onyx SEARCH_ADVANCED_FILTERS_FORM to render filter chips.
Resetting a filter chip opens a popup (CommonPopup, TextInputPopup, etc.) and clicking Reset calls updateFilterForm({[filterKey]: undefined}) via useUpdateFilterQuery(queryJSON, true), which calls close(() => Navigation.setParams({q: updatedQueryString})).
useSearchFilterSync uses a module-level lastSyncedQuerySig to prevent redundant syncs on remount.
Why the filter reappears: When the user navigates back to Spend from Workspaces, the Search screen unfreezes. SearchActionsBarSwitch transitions from showStatic=true to showStatic=false (via startTransition + useFocusEffect), which remounts SearchAdvancedFiltersButton. useSearchFilterSync fires its effect. If the URL q param at this point still contains merchant:foo (because the Navigation.setParams callback was delayed, lost, or the navigation framework restored the old params on tab switch), then querySig for merchant:foo differs from lastSyncedQuerySig (which was updated to the reset value), causing updateAdvancedFilters to write the merchant filter back into Onyx — making the chip reappear.
PR Add withdrawal-status search filter #88246 (in staging) modifies useSearchFiltersBar.tsx by adding FILTER_KEYS.WITHDRAWAL_STATUS handling. It also adds a new filter that goes through the same reset code paths. While this PR is unlikely to be the direct cause, it is the only staging-cycle PR touching the search filter bar.
The tab navigator uses freezeOnBlur: true (src/libs/Navigation/AppNavigator/Navigators/TabNavigator.tsx). When the user returns to Spend, the screen unfreezes and isHeaderInteractive transitions from false to true via startTransition, remounting SearchAdvancedFiltersButton.
Root Cause
The most probable root cause is a race condition or navigation state issue: after the user clicks Reset in the filter chip popup, the Navigation.setParams({q: defaultQuery}) call (deferred through the Modal close() callback) either races with or loses to the tab navigation, leaving the URL q param set to the old merchant:foo value. When the user returns to Spend, useSearchFilterSync sees the stale merchant:foo URL and writes it back to Onyx.
The lastSyncedQuerySig module-level variable (introduced by PR #89082) is the right mechanism but only works correctly if the URL update successfully propagates before any refocus-triggered sync.
Suggested next steps:
Reproduce the bug and log the value of q param when the screen regains focus after the tab switch.
Verify whether Navigation.setParams fires correctly after the popup Reset on iOS/Chrome.
Consider resetting lastSyncedQuerySig (or nullifying it) when clearAdvancedFilters or popup reset is called, so the next focus-triggered sync always re-evaluates from the URL — regardless of whether the URL update raced with navigation.
When a filter is reset, the URL q param updates correctly, but saveLastSearchParams is skipped because the default query's snapshot data was already loaded from the user's initial visit (before any filter was applied). The guard if (isSnapshotDataLoaded || isSnapshotSearchLoading) { return; } short-circuits both search() and saveLastSearchParams(), so the Onyx key REPORT_NAVIGATION_LAST_SEARCH_QUERY retains the old filtered query.
When the user navigates to a different tab, cleanPreservedNavigatorStates deletes the search navigator's preserved state (since it's nested inside TAB_NAVIGATOR, not at the root level). When the user returns to the Spend tab, SearchTabButton.navigateToSearch tries getLastRoute() first (returns undefined since preserved state was cleaned), then falls back to the stale lastSearchParams from Onyx — restoring the old filter.
What changes do you think we should make in order to solve the problem?
In useSearchPageSetup.ts, saveLastSearchParams should be called unconditionally (outside the early-return guard), so that any query change — including one where the snapshot is already loaded — still updates REPORT_NAVIGATION_LAST_SEARCH_QUERY in Onyx. The search() API call can remain gated behind isSnapshotDataLoaded since there's no need to re-fetch already-loaded data, but saving the last search params is always necessary to keep tab restoration in sync with the current URL.
Move saveLastSearchParams(...) after the early return so it runs on every hash change regardless of snapshot state.
What alternative solutions did you explore? (Optional)
An alternative would be to fix cleanPreservedNavigatorStates to not delete the search navigator's state on tab switches (by also checking tab-nested route keys). However, this only masks the Onyx staleness — if preserved state were unavailable for any other reason, the bug would resurface. Fixing the source of truth (saveLastSearchParams) is the more robust approach.
Investigation details
Data flow of the bug:
User applies merchant:foo filter → URL gets q=type:expense+merchant:foo, saveLastSearchParams saves this to Onyx
User clicks Reset → useUpdateFilterQuery builds the default query, calls Navigation.setParams({q: type:expense+status:all})
URL updates, useSearchPageSetup effect fires for the new hash, but isSnapshotDataLoaded is true (default query was loaded earlier) → saveLastSearchParams is skipped
Onyx REPORT_NAVIGATION_LAST_SEARCH_QUERY still holds the filtered query
User navigates to Workspaces tab → root state changes → cleanPreservedNavigatorStates deletes search navigator's preserved state
User returns to Spend tab → SearchTabButton.navigateToSearch runs → getLastRoute returns undefined → falls back to stale Onyx value → navigates with old filtered query
Related issues:#89048 appears to describe a related symptom (exposed filter can't be reset after closing Filters RHP).
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.
changed the title [-]Spend - Search results appear after resetting filter, navigating to a different tab and back[/-][+][Due for payment 2026-05-20] Spend - Search results appear after resetting filter, navigating to a different tab and back[/+]on May 13, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.72-1 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@dmkt9 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]
Activity
melvin-bot commentedon May 8, 2026
Triggered auto assignment to @yuwenmemon (
DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.melvin-bot commentedon May 8, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon May 8, 2026
👋 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:
OSBotify commentedon May 8, 2026
Investigation Summary
Classification: Frontend bug
Causing PR: Could not be identified with high confidence — see Detailed Analysis below
Related Issues: Similar to #89013 (previously fixed by #89082)
Recommendation: NEEDS INVESTIGATION
The filter chip reappearing after Reset + tab navigation is a known fragile area of the codebase. The fix in PR #89082 (module-level
lastSyncedQuerySiginuseSearchFilterSync) addressed the same class of bug, but the current report suggests a surviving or re-introduced edge case. The root cause requires hands-on reproduction by someone familiar with the Search filter sync mechanism.Assigned: @wildan-m (author of PR #88246, the only staging-cycle PR that modifies
useSearchFiltersBar.tsx), @joekaufmanexpensify, @dmkt9 (approvers of PR #88246)Labels:
DeployBlockerCashlabel kept — this is a staging-only, App-side bug affecting a core Search UX flow. No label changes made.Detailed Analysis
Evidence
Bug Summary: After applying a
merchant:[no-results]filter via the search input, expanding the filter chip's dropdown popup, and clicking Reset inside the popup, the filter chip initially disappears. However, after navigating to the Workspaces tab and returning to Spend/Expenses, the filter chip and filtered (empty) results reappear.Platform: iOS native and Windows/Chrome (staging only, not production).
Affected code path:
SearchAdvancedFiltersButtoncallsuseSearchFilterSync(queryJSON, filterFormValues)which syncs the URL-derivedqueryJSONinto the OnyxSEARCH_ADVANCED_FILTERS_FORMkey.useSearchFiltersBarreads from OnyxSEARCH_ADVANCED_FILTERS_FORMto render filter chips.CommonPopup,TextInputPopup, etc.) and clicking Reset callsupdateFilterForm({[filterKey]: undefined})viauseUpdateFilterQuery(queryJSON, true), which callsclose(() => Navigation.setParams({q: updatedQueryString})).useSearchFilterSyncuses a module-levellastSyncedQuerySigto prevent redundant syncs on remount.Why the filter reappears: When the user navigates back to Spend from Workspaces, the Search screen unfreezes.
SearchActionsBarSwitchtransitions fromshowStatic=truetoshowStatic=false(viastartTransition+useFocusEffect), which remountsSearchAdvancedFiltersButton.useSearchFilterSyncfires its effect. If the URLqparam at this point still containsmerchant:foo(because theNavigation.setParamscallback was delayed, lost, or the navigation framework restored the old params on tab switch), thenquerySigformerchant:foodiffers fromlastSyncedQuerySig(which was updated to the reset value), causingupdateAdvancedFiltersto write the merchant filter back into Onyx — making the chip reappear.Verification
src/hooks/useSearchFilterSync.ts,src/components/Search/SearchPageHeader/useSearchFiltersBar.tsx,src/components/Search/hooks/useUpdateFilterQuery.tsxuseSearchFiltersBar.tsxby addingFILTER_KEYS.WITHDRAWAL_STATUShandling. It also adds a new filter that goes through the same reset code paths. While this PR is unlikely to be the direct cause, it is the only staging-cycle PR touching the search filter bar.freezeOnBlur: true(src/libs/Navigation/AppNavigator/Navigators/TabNavigator.tsx). When the user returns to Spend, the screen unfreezes andisHeaderInteractivetransitions fromfalsetotrueviastartTransition, remountingSearchAdvancedFiltersButton.Root Cause
The most probable root cause is a race condition or navigation state issue: after the user clicks Reset in the filter chip popup, the
Navigation.setParams({q: defaultQuery})call (deferred through the Modalclose()callback) either races with or loses to the tab navigation, leaving the URLqparam set to the oldmerchant:foovalue. When the user returns to Spend,useSearchFilterSyncsees the stalemerchant:fooURL and writes it back to Onyx.The
lastSyncedQuerySigmodule-level variable (introduced by PR #89082) is the right mechanism but only works correctly if the URL update successfully propagates before any refocus-triggered sync.Suggested next steps:
qparam when the screen regains focus after the tab switch.Navigation.setParamsfires correctly after the popup Reset on iOS/Chrome.lastSyncedQuerySig(or nullifying it) whenclearAdvancedFiltersor popup reset is called, so the next focus-triggered sync always re-evaluates from the URL — regardless of whether the URL update raced with navigation.MelvinBot commentedon May 8, 2026
Proposal
What is the root cause of that problem?
When a filter is reset, the URL
qparam updates correctly, butsaveLastSearchParamsis skipped because the default query's snapshot data was already loaded from the user's initial visit (before any filter was applied). The guardif (isSnapshotDataLoaded || isSnapshotSearchLoading) { return; }short-circuits bothsearch()andsaveLastSearchParams(), so the Onyx keyREPORT_NAVIGATION_LAST_SEARCH_QUERYretains the old filtered query.When the user navigates to a different tab,
cleanPreservedNavigatorStatesdeletes the search navigator's preserved state (since it's nested insideTAB_NAVIGATOR, not at the root level). When the user returns to the Spend tab,SearchTabButton.navigateToSearchtriesgetLastRoute()first (returnsundefinedsince preserved state was cleaned), then falls back to the stalelastSearchParamsfrom Onyx — restoring the old filter.What changes do you think we should make in order to solve the problem?
In
useSearchPageSetup.ts,saveLastSearchParamsshould be called unconditionally (outside the early-return guard), so that any query change — including one where the snapshot is already loaded — still updatesREPORT_NAVIGATION_LAST_SEARCH_QUERYin Onyx. Thesearch()API call can remain gated behindisSnapshotDataLoadedsince there's no need to re-fetch already-loaded data, but saving the last search params is always necessary to keep tab restoration in sync with the current URL.Move
saveLastSearchParams(...)after the early return so it runs on everyhashchange regardless of snapshot state.What alternative solutions did you explore? (Optional)
An alternative would be to fix
cleanPreservedNavigatorStatesto not delete the search navigator's state on tab switches (by also checking tab-nested route keys). However, this only masks the Onyx staleness — if preserved state were unavailable for any other reason, the bug would resurface. Fixing the source of truth (saveLastSearchParams) is the more robust approach.Investigation details
Data flow of the bug:
merchant:foofilter → URL getsq=type:expense+merchant:foo,saveLastSearchParamssaves this to OnyxuseUpdateFilterQuerybuilds the default query, callsNavigation.setParams({q: type:expense+status:all})useSearchPageSetupeffect fires for the new hash, butisSnapshotDataLoadedistrue(default query was loaded earlier) →saveLastSearchParamsis skippedREPORT_NAVIGATION_LAST_SEARCH_QUERYstill holds the filtered querycleanPreservedNavigatorStatesdeletes search navigator's preserved stateSearchTabButton.navigateToSearchruns →getLastRoutereturnsundefined→ falls back to stale Onyx value → navigates with old filtered queryRelated issues: #89048 appears to describe a related symptom (exposed filter can't be reset after closing Filters RHP).
Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.6 remaining items
LukasMod commentedon May 11, 2026
Fix ready for review, I added chrome/ios video
#90156
LukasMod commentedon May 11, 2026
Main PR was reverted, I recreated it with this fix: #90175
IuliiaHerets commentedon May 11, 2026
Chrome / v9.3.69-4
Still fails
b1b2390702e861e7f9e993d7457b5b6e.mp4
LukasMod commentedon May 11, 2026
@IuliiaHerets Where is the issue in this video? I don't see you applying the filter and resetting it before changing the tab (repro steps 4 and 5).
IuliiaHerets commentedon May 11, 2026
Chrome / v9.3.69-10
Passed
REC-20260511161845.mp4
[-]Spend - Search results appear after resetting filter, navigating to a different tab and back[/-][+][Due for payment 2026-05-20] Spend - Search results appear after resetting filter, navigating to a different tab and back[/+]melvin-bot commentedon May 13, 2026
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon May 13, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.72-1 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-05-20. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon May 13, 2026
@dmkt9 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]