Skip to content

[$175] perf: stop the Saved searches section from rerendering on unrelated Onyx writes #108488

Todo

Description

@mountiny

Problem

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.

PR

#108459

Issue OwnerCurrent Issue Owner: @daledah
Upwork Automation - Do Not Edit

Activity

  1. added
    Reviewing
    Daily
    Bug
    on Dec 1, 2026
  2. self-assigned this
    on Dec 1, 2026
  3. added
    Weekly
    and removed
    Daily
    on Dec 1, 2026
  4. added
    External
    on Dec 1, 2026
  5. expensify-chore-bot commented on Dec 1, 2026

    @expensify-chore-bot

    Current assignee @daledah is eligible for the External assigner, not assigning anyone new.

  6. 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
  7. expensify-chore-bot commented on Dec 1, 2026

    @expensify-chore-bot
  8. MelvinBot commented on Dec 1, 2026

    @MelvinBot
    Contributor

    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:

    • 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.

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugDailyExternalReviewing

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions