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-22] [Due for payment 2026-05-20] Spend - Filter results are not cleared after clearing cache. #90527
👋 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.
The search query (e.g. amount:10) is stored in React Navigation route params and in an in-memory JS dictionary (preservedNavigatorStates), neither of which are cleared by Onyx.clear().
A safety net exists — TroubleshootPage sets shouldResetSearchQuery = true before clearing — but the reset effect in Search/index.tsx is gated on hasErrors being true. After cache clear, snapshot data (and its errors) are gone, so hasErrors is false and the reset never fires.
What changes do you think we should make in order to solve the problem?
Two changes are needed:
In clearOnyxAndResetApp(): Call clearPreservedSearchNavigatorStates() (which already exists and is exported) alongside Navigation.clearPreloadedRoutes(). This clears the in-memory preserved navigation state so SearchFullscreenRouter and SearchTabButton don't restore the stale query.
In Search/index.tsx: Separate the shouldResetSearchQuery branch from the hasErrors guard. When shouldResetSearchQuery is true and the route is /search, the nav params should be reset unconditionally, regardless of hasErrors.
What alternative solutions did you explore? (Optional)
Resetting all navigation state during cache clear (e.g., navigating to HOME): This would work but is heavier than needed and could cause visual jank. Targeted clearing of just the search navigator state is more surgical.
Only fixing the hasErrors guard: This alone isn't sufficient because SearchTabButton and SearchFullscreenRouter.getInitialState() read directly from preservedNavigatorStates before the Search component's effect even runs.
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.
Classification: Frontend bug Causing PR: No single staging PR identified — pre-existing defect (Low confidence on any single PR) Related Issues: None found
Recommendation: NEEDS INVESTIGATION
The root cause is a pre-existing gap in clearOnyxAndResetApp: it clears Onyx data but does not reset the in-memory preservedNavigatorStates map used by the search tab navigation. When the user navigates back to Spend after clearing cache, SearchTabButton reads the stale preserved state and restores the old search query (amount:10). A targeted fix — calling clearPreservedSearchNavigatorStates() inside clearOnyxAndResetApp — would resolve this without reverting any staging PR. The author of the TroubleshootPage / clearOnyxAndResetApp area and the SearchTabButton author should be tagged for a quick fix.
Assigned: N/A — no single causing PR identified with sufficient confidence Labels: No label changes made. DeployBlockerCash is correct (frontend fix required in App). DeployBlocker is not present and should not be added.
Detailed Analysis
Evidence
The bug is staging-only and reproducible on Android.
Reproduction: search with amount:10 in Spend, clear data via Troubleshoot, navigate back to Spend — filters persist.
All staging PRs in the current cycle were inspected. No single PR was found that changed the cache-clear or search-filter-persistence logic in a way that would introduce this regression.
The SearchTabButton.tsx component (last changed in PR Update search groupings and suggested search names in LHN #88181, April 2026, before this staging cycle) uses getLastRoute() to restore search params from preservedNavigatorStates, an in-memory JavaScript module-level map.
Verification
Affected files:
src/components/Navigation/NavigationTabBar/SearchTabButton.tsx — calls getLastRoute which reads preservedNavigatorStates
src/libs/Navigation/AppNavigator/createSplitNavigator/usePreserveNavigatorState.ts — defines preservedNavigatorStates and clearPreservedSearchNavigatorStates()
src/libs/actions/App.ts — clearOnyxAndResetApp does NOT call clearPreservedSearchNavigatorStates()
The preserved state is only cleared in Delegate.ts (lines 202 and 291), not during cache clear.
Root Cause
When clearOnyxAndResetApp() is called from TroubleshootPage:
Onyx is cleared (REPORT_NAVIGATION_LAST_SEARCH_QUERY and other search-related keys are wiped).
Navigation.clearPreloadedRoutes() is called but this only clears preloaded routes, not the preservedNavigatorStates module-level object.
preservedNavigatorStates still contains the SEARCH_FULLSCREEN_NAVIGATOR route with the previous q=amount:10 param.
When the user taps "Spend", SearchTabButton.navigateToSearch() calls getLastRoute(navigationRef.getRootState(), NAVIGATORS.SEARCH_FULLSCREEN_NAVIGATOR, SCREENS.SEARCH.ROOT).
getLastRoute calls getPreservedNavigatorState(lastNavigatorKey) which returns the stale state.
The tab button navigates to ROUTES.SEARCH_ROOT.getRoute({query: "amount:10", ...}).
Fix direction: Call clearPreservedSearchNavigatorStates() inside clearOnyxAndResetApp in src/libs/actions/App.ts. This is a targeted, low-risk fix that does not require reverting any staging PR.
There is also a setShouldResetSearchQuery(true) call in TroubleshootPage before clearOnyxAndResetApp(), which sets a React context value intended to reset the search query. However, this mechanism only fires when hasErrors is truthy in the Search component's useEffect, and after Onyx clear searchResults has no errors (it is undefined), so this reset path never executes.
changed the title [-]Spend - Filter results are not cleared after clearing cache.[/-][+][Due for payment 2026-05-20] Spend - Filter results are not cleared after clearing cache.[/+]on May 13, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.73-4 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@JS00001 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]
changed the title [-][Due for payment 2026-05-20] Spend - Filter results are not cleared after clearing cache.[/-][+][Due for payment 2026-05-22] [Due for payment 2026-05-20] Spend - Filter results are not cleared after clearing cache.[/+]on May 15, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.74-7 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@JS00001 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 13, 2026
Triggered auto assignment to @JS00001 (
DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.melvin-bot commentedon May 13, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon May 13, 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:
MelvinBot commentedon May 13, 2026
Proposal
What is the root cause of that problem?
The search query (e.g.
amount:10) is stored in React Navigation route params and in an in-memory JS dictionary (preservedNavigatorStates), neither of which are cleared byOnyx.clear().clearOnyxAndResetApp()wipes Onyx data but never callsclearPreservedSearchNavigatorStates(), so the in-memory preserved state retains the old query.A safety net exists —
TroubleshootPagesetsshouldResetSearchQuery = truebefore clearing — but the reset effect inSearch/index.tsxis gated onhasErrorsbeingtrue. After cache clear, snapshot data (and its errors) are gone, sohasErrorsisfalseand the reset never fires.What changes do you think we should make in order to solve the problem?
Two changes are needed:
In
clearOnyxAndResetApp(): CallclearPreservedSearchNavigatorStates()(which already exists and is exported) alongsideNavigation.clearPreloadedRoutes(). This clears the in-memory preserved navigation state soSearchFullscreenRouterandSearchTabButtondon't restore the stale query.In
Search/index.tsx: Separate theshouldResetSearchQuerybranch from thehasErrorsguard. WhenshouldResetSearchQueryistrueand the route is/search, the nav params should be reset unconditionally, regardless ofhasErrors.What alternative solutions did you explore? (Optional)
hasErrorsguard: This alone isn't sufficient becauseSearchTabButtonandSearchFullscreenRouter.getInitialState()read directly frompreservedNavigatorStatesbefore the Search component's effect even runs.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.OSBotify commentedon May 13, 2026
Investigation Summary
Classification: Frontend bug
Causing PR: No single staging PR identified — pre-existing defect (Low confidence on any single PR)
Related Issues: None found
Recommendation: NEEDS INVESTIGATION
The root cause is a pre-existing gap in
clearOnyxAndResetApp: it clears Onyx data but does not reset the in-memorypreservedNavigatorStatesmap used by the search tab navigation. When the user navigates back to Spend after clearing cache,SearchTabButtonreads the stale preserved state and restores the old search query (amount:10). A targeted fix — callingclearPreservedSearchNavigatorStates()insideclearOnyxAndResetApp— would resolve this without reverting any staging PR. The author of the TroubleshootPage / clearOnyxAndResetApp area and the SearchTabButton author should be tagged for a quick fix.Assigned: N/A — no single causing PR identified with sufficient confidence
Labels: No label changes made.
DeployBlockerCashis correct (frontend fix required in App).DeployBlockeris not present and should not be added.Detailed Analysis
Evidence
amount:10in Spend, clear data via Troubleshoot, navigate back to Spend — filters persist.SearchTabButton.tsxcomponent (last changed in PR Update search groupings and suggested search names in LHN #88181, April 2026, before this staging cycle) usesgetLastRoute()to restore search params frompreservedNavigatorStates, an in-memory JavaScript module-level map.Verification
Affected files:
src/components/Navigation/NavigationTabBar/SearchTabButton.tsx— callsgetLastRoutewhich readspreservedNavigatorStatessrc/libs/Navigation/AppNavigator/createSplitNavigator/usePreserveNavigatorState.ts— definespreservedNavigatorStatesandclearPreservedSearchNavigatorStates()src/libs/actions/App.ts—clearOnyxAndResetAppdoes NOT callclearPreservedSearchNavigatorStates()The preserved state is only cleared in
Delegate.ts(lines 202 and 291), not during cache clear.Root Cause
When
clearOnyxAndResetApp()is called from TroubleshootPage:REPORT_NAVIGATION_LAST_SEARCH_QUERYand other search-related keys are wiped).Navigation.clearPreloadedRoutes()is called but this only clears preloaded routes, not thepreservedNavigatorStatesmodule-level object.preservedNavigatorStatesstill contains theSEARCH_FULLSCREEN_NAVIGATORroute with the previousq=amount:10param.SearchTabButton.navigateToSearch()callsgetLastRoute(navigationRef.getRootState(), NAVIGATORS.SEARCH_FULLSCREEN_NAVIGATOR, SCREENS.SEARCH.ROOT).getLastRoutecallsgetPreservedNavigatorState(lastNavigatorKey)which returns the stale state.ROUTES.SEARCH_ROOT.getRoute({query: "amount:10", ...}).Fix direction: Call
clearPreservedSearchNavigatorStates()insideclearOnyxAndResetAppinsrc/libs/actions/App.ts. This is a targeted, low-risk fix that does not require reverting any staging PR.There is also a
setShouldResetSearchQuery(true)call in TroubleshootPage beforeclearOnyxAndResetApp(), which sets a React context value intended to reset the search query. However, this mechanism only fires whenhasErrorsis truthy in the Search component'suseEffect, and after Onyx clearsearchResultshas no errors (it is undefined), so this reset path never executes.IuliiaHerets commentedon May 13, 2026
Xiaomi Redmi Note 10 / Android 12
App 9.3.73-4
Not repro
Screenrecorder-2026-05-13-21-59-21-698.mp4
[-]Spend - Filter results are not cleared after clearing cache.[/-][+][Due for payment 2026-05-20] Spend - Filter results are not cleared after clearing cache.[/+]melvin-bot commentedon May 13, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.73-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-05-20. 🎊
melvin-bot commentedon May 13, 2026
@JS00001 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]
[-][Due for payment 2026-05-20] Spend - Filter results are not cleared after clearing cache.[/-][+][Due for payment 2026-05-22] [Due for payment 2026-05-20] Spend - Filter results are not cleared after clearing cache.[/+]melvin-bot commentedon May 15, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.74-7 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-22. 🎊
melvin-bot commentedon May 15, 2026
@JS00001 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]