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
[$175] perf: stop the Saved searches section from rerendering on unrelated Onyx writes #108488
BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in review
The Saved searches section subscribed to whole collections (reports, policies, cards, personal details) only to resolve titles for saved searches that were never renamed. Those collections change on almost every server push, so all rows were rebuilt constantly. On a heavy account, the section took 314 ms to render across 18 renders for 10 unrelated writes.
Solution
SavedSearchList now subscribes to one boolean: is any saved search named after its raw query. Only then does a separate wrapper read the data, through the new useResolvedSavedSearchTitles hook, so rows rebuild only when a title changes. The last used query is read with Onyx.get on press and on delete confirm. Render time for the section dropped to 0.1 ms with 0 renders.
changed the title [-]perf: stop the Saved searches section from rerendering on unrelated Onyx writes[/-][+][$175] perf: stop the Saved searches section from rerendering on unrelated Onyx writes[/+]on Dec 1, 2026
Confidence: Medium — supported by code and test inspection; performance measurements were not independently reproduced.
What is the root cause of that problem?
The Saved searches list subscribes to entire collections needed to generate readable titles, even when all searches have custom names. Unrelated collection updates therefore trigger component work unnecessarily. Skipping title generation afterward does not prevent those subscription-driven renders.
useSavedSearchTitles.ts:17–62 already skips custom names and preserves equivalent title maps, but cannot prevent its caller from rendering.
SavedSearchList.tsx:132–188 also makes row construction depend on last-used queries that are only needed when opening a search.
What changes do you think we should make in order to solve the problem?
The existing Saved searches performance PR addresses the identified mechanism; no separate implementation is needed:
Mount the title-data subscriber only when at least one search needs a generated title.
Separate title resolution from list rendering and preserve equivalent title-map references.
Read last-used queries when pressing a search or confirming deletion instead of subscribing during rendering.
Scope clarification: This removes the identified subscription path for custom-named searches. Unnamed searches still require title-resolution work, and legitimate UI changes can still render the list. Narrow and Flat navigation share the resolver but do not gain the same conditional subscription boundary.
Validation and remaining checks
The conditional wrapper implements the subscription boundary. The body retains its saved-search subscription, so renames and deletions remain reactive.
Added tests cover unrelated report writes, relevant title updates, and renaming the last unnamed search. These tests were inspected, not executed; they measure a mocked list boundary rather than browser rendering time.
Before acceptance, verify:
Updating the last-used query after mounting, then pressing the saved search, opens the updated query.
Offline deletion, reconnection, and rollback retain existing behavior.
Crossing between all-custom and unnamed searches preserves expected focus/menu behavior, because that transition remounts the list body.
No concrete correctness regression was found by static inspection. Production logs are not needed to establish this client-side subscription mechanism; browser profiling is needed to independently confirm the reported performance improvement.
What alternative solutions did you explore? (Optional)
Further memoizing generated titles alone would not remove the parent’s broad subscriptions; equivalent-map reuse already exists. The conditional subscriber boundary addresses the earlier source of unnecessary work.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/108488) to create a draft PR. An implementation PR already exists, so reviewing it is preferable. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in review
Activity
expensify-chore-bot commentedon Dec 1, 2026
Current assignee @daledah is eligible for the External assigner, not assigning anyone new.
[-]perf: stop the Saved searches section from rerendering on unrelated Onyx writes[/-][+][$175] perf: stop the Saved searches section from rerendering on unrelated Onyx writes[/+]expensify-chore-bot commentedon Dec 1, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022127794284021943558
MelvinBot commentedon Dec 1, 2026
Proposal
Confidence: Medium — supported by code and test inspection; performance measurements were not independently reproduced.
What is the root cause of that problem?
The Saved searches list subscribes to entire collections needed to generate readable titles, even when all searches have custom names. Unrelated collection updates therefore trigger component work unnecessarily. Skipping title generation afterward does not prevent those subscription-driven renders.
Code evidence
What changes do you think we should make in order to solve the problem?
The existing Saved searches performance PR addresses the identified mechanism; no separate implementation is needed:
Scope clarification: This removes the identified subscription path for custom-named searches. Unnamed searches still require title-resolution work, and legitimate UI changes can still render the list. Narrow and Flat navigation share the resolver but do not gain the same conditional subscription boundary.
Validation and remaining checks
The conditional wrapper implements the subscription boundary. The body retains its saved-search subscription, so renames and deletions remain reactive.
Added tests cover unrelated report writes, relevant title updates, and renaming the last unnamed search. These tests were inspected, not executed; they measure a mocked list boundary rather than browser rendering time.
Before acceptance, verify:
No concrete correctness regression was found by static inspection. Production logs are not needed to establish this client-side subscription mechanism; browser profiling is needed to independently confirm the reported performance improvement.
What alternative solutions did you explore? (Optional)
Further memoizing generated titles alone would not remove the parent’s broad subscriptions; equivalent-map reuse already exists. The conditional subscriber boundary addresses the earlier source of unnecessary work.
Related issue: Keep SearchQueryContext stable when an unrelated policy changes addresses a separate context-driven rendering path, not a confirmed duplicate.
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/108488)to create a draft PR. An implementation PR already exists, so reviewing it is preferable.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run