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
Spend - Inconsistent behavior with Total selector when reopening saved search #104031
Version Number: 9.5.9-0 Reproducible in staging?: Yes Reproducible in production?: N/A - new feature, doesn't exist in prod If this was caught during regression testing, add the test name, ID and link from BrowserStack:#100674 Email or phone of affected tester (no customers):[email protected] Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Mac 26.5 / Chrome App Component: Search
Action Performed:
Precondition:
Enable spendFooterSelectors beta.
Go to staging.new.expensify.com
Go to workspace chat.
Create an expense.
Go to Spend > Expenses.
Click total spend on the footer.
Click Total > select Reimbursable > Apply.
Click Save button next to search field.
Enter name > Save view.
Go to the saved search from Step 8.
Click total spend on the footer.
Click Total > select Spend > Apply.
Go to Expenses then go back to the saved search.
→ Total is reset to Reimbursable when the previous selector is Spend.
Click total spend on the footer.
Click Total > select Non-reimbursable > Apply.
Go to Expenses then go back to the saved search.
→ Total is not reset to Reimbursable when the previous selector is not Spend.
Expected Result:
In Step 12 and 15, after reopening saved search, total selector should behave the same (reset or not reset to the saved selector).
Actual Result:
In Step 12, when the previous selector is Spend, Total is reset to Reimbursable.
In Step 15, when the previous selector is not Spend, Total is not reset to Reimbursable.
👋 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.
Root cause: Picking Spend removes the footerTotal filter from the query, because it is the default. When you reopen the saved search, doesQueryMatchDefaultFilterKeysAndType requires every filter key in the saved query to exist in the last query. The saved query has footerTotal:reimbursable, so the last query without footerTotal is rejected, and the app falls back to Reimbursable. Non-reimbursable keeps the footerTotal key, so it passes.
Recommendation: Roll forward with a small fix. Reverting would back out the whole beta feature (45 files). Ignore footer keys in the key-presence check at SearchQueryUtils.ts:3128, using the existing FOOTER_FILTER_KEYS:
With this fix, the last-used footer selection is always restored. This is consistent in both steps 12 and 15.
Investigation details
getQueryWithFooterSelection skips footerTotal when the value is TOTAL ("Spend"). It also skips footerCount when the value is the type's default count. That query is stored as the saved search's last query.
SavedSearchList.tsx:149 builds the query to open with getValidLastQuery(lastQuery, item.query).
getValidLastQuery returns the saved query whenever a saved filter key is missing from the last query. It checks only that each key is present, not its value.
Related effects:
footerCount has the same bug. Save a view with a non-default count, switch back to the default count, and the view resets.
SearchTypeMenuNarrow.tsx uses the same check, so mobile is affected too.
The PR already excludes footer keys from the query hash and from filter chips. It missed this check.
The other caller, useSearchKeyParam.ts, only checks suggested searches, and their default queries have no footer keys. The fix doesn't change its behavior.
Alternative: if Product wants a reopened view to always reset to the saved selector, write footerTotal:total out when the saved query has a non-default value. This change is more invasive, because getQueryWithFooterSelection has no access to the saved query.
A unit test should cover getValidLastQuery(<query without footerTotal>, <saved query with footerTotal:reimbursable>) returning the last query.
Next Steps: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.
Spend is the default total, so getQueryWithFooterSelection drops footerTotal from the query when you pick it. That query is stored as the saved search's last query.
When you reopen the saved search, SavedSearchList.tsx:149 calls getValidLastQuery. Its check, doesQueryMatchDefaultFilterKeysAndType, throws out the last query if any filter key in the saved query is missing from it. The check looks only at which keys are present, not at their values.
The saved query has footerTotal:reimbursable.
Spend: the last query has no footerTotal key, so the check fails and the app reopens the saved query (Reimbursable).
Non-reimbursable: the last query has footerTotal:nonReimbursable. The key is present, so the check passes and the last query is kept.
What changes do you think we should make in order to solve the problem?
In doesQueryMatchDefaultFilterKeysAndType, ignore footer keys when building the list of required keys from the default query. Use the existing FOOTER_FILTER_KEYS set for this.
Footer keys pick what the footer shows. They don't filter rows, so they shouldn't decide whether a last query is still valid. After this change, the last footer choice always comes back when you reopen a saved search. This matches the selections the footer already saves for each search.
The fix also covers:
footerCount, which has the same bug when you switch back to the default count.
The other callers check against canned or suggested search queries. Those queries have no footer keys, so their behavior doesn't change.
Add unit tests for getValidLastQuery:
A saved query with footerTotal:reimbursable and a last query without footerTotal returns the last query.
A saved query with a non-default footerCount and a last query with the default count returns the last query.
Removing a real filter (for example, status) from the last query still returns the saved query.
What alternative solutions did you explore? (Optional)
Always reset to the saved selector instead. To do this, write footerTotal:total into the query when you pick Spend and the saved query has a non-default total. This change is larger, because getQueryWithFooterSelection has no access to the saved query. It would also mean a saved search never remembers a footer choice you made later.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/104031) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
Activity
applause-bot commentedon Oct 14, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/0153a5187d27a96b6b7f4797057c5857553fd8ef825ad9c6df7c92cc1bc69e4c
melvin-bot commentedon Oct 14, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #100674
melvin-bot commentedon Oct 14, 2026
@JS00001 @mkhutornyi you have been assigned to this deploy blocker because you reviewed the offending PR: #100674
melvin-bot commentedon Oct 14, 2026
@truph01 you have been assigned to this deploy blocker because you authored the offending PR: #100674
melvin-bot commentedon Oct 14, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon Oct 14, 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 Oct 14, 2026
Deploy Blocker Analysis
Causing PR: feat: Add count and spend total selectors to the Spend footer (high confidence). No other PR in the current checklist touches the footer, saved-search, or last-query code.
Root cause: Picking Spend removes the
footerTotalfilter from the query, because it is the default. When you reopen the saved search,doesQueryMatchDefaultFilterKeysAndTyperequires every filter key in the saved query to exist in the last query. The saved query hasfooterTotal:reimbursable, so the last query withoutfooterTotalis rejected, and the app falls back to Reimbursable. Non-reimbursable keeps thefooterTotalkey, so it passes.Recommendation: Roll forward with a small fix. Reverting would back out the whole beta feature (45 files). Ignore footer keys in the key-presence check at
SearchQueryUtils.ts:3128, using the existingFOOTER_FILTER_KEYS:With this fix, the last-used footer selection is always restored. This is consistent in both steps 12 and 15.
Investigation details
getQueryWithFooterSelectionskipsfooterTotalwhen the value isTOTAL("Spend"). It also skipsfooterCountwhen the value is the type's default count. That query is stored as the saved search's last query.SavedSearchList.tsx:149builds the query to open withgetValidLastQuery(lastQuery, item.query).getValidLastQueryreturns the saved query whenever a saved filter key is missing from the last query. It checks only that each key is present, not its value.Related effects:
footerCounthas the same bug. Save a view with a non-default count, switch back to the default count, and the view resets.SearchTypeMenuNarrow.tsxuses the same check, so mobile is affected too.useSearchKeyParam.ts, only checks suggested searches, and their default queries have no footer keys. The fix doesn't change its behavior.Alternative: if Product wants a reopened view to always reset to the saved selector, write
footerTotal:totalout when the saved query has a non-default value. This change is more invasive, becausegetQueryWithFooterSelectionhas no access to the saved query.A unit test should cover
getValidLastQuery(<query without footerTotal>, <saved query with footerTotal:reimbursable>)returning the last query.Next Steps: Reply with
@MelvinBot implement thisto create a draft PR, or@MelvinBot <your feedback>to refine this analysis.JS00001 commentedon Oct 14, 2026
this is behind a beta, closing btu adding as a follow up
truph01 commentedon Oct 15, 2026
@MelvinBot Post proposal
MelvinBot commentedon Oct 15, 2026
Proposal
What is the root cause of that problem?
Spend is the default total, so
getQueryWithFooterSelectiondropsfooterTotalfrom the query when you pick it. That query is stored as the saved search's last query.When you reopen the saved search,
SavedSearchList.tsx:149callsgetValidLastQuery. Its check,doesQueryMatchDefaultFilterKeysAndType, throws out the last query if any filter key in the saved query is missing from it. The check looks only at which keys are present, not at their values.footerTotal:reimbursable.footerTotalkey, so the check fails and the app reopens the saved query (Reimbursable).footerTotal:nonReimbursable. The key is present, so the check passes and the last query is kept.What changes do you think we should make in order to solve the problem?
In
doesQueryMatchDefaultFilterKeysAndType, ignore footer keys when building the list of required keys from the default query. Use the existingFOOTER_FILTER_KEYSset for this.Footer keys pick what the footer shows. They don't filter rows, so they shouldn't decide whether a last query is still valid. After this change, the last footer choice always comes back when you reopen a saved search. This matches the selections the footer already saves for each search.
The fix also covers:
footerCount, which has the same bug when you switch back to the default count.SearchTypeMenuNarrow.tsx:217uses the same check.The other callers check against canned or suggested search queries. Those queries have no footer keys, so their behavior doesn't change.
Add unit tests for
getValidLastQuery:footerTotal:reimbursableand a last query withoutfooterTotalreturns the last query.footerCountand a last query with the default count returns the last query.status) from the last query still returns the saved query.What alternative solutions did you explore? (Optional)
Always reset to the saved selector instead. To do this, write
footerTotal:totalinto the query when you pick Spend and the saved query has a non-default total. This change is larger, becausegetQueryWithFooterSelectionhas no access to the saved query. It would also mean a saved search never remembers a footer choice you made later.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/104031)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.