Skip to content

refactor: split SearchContext into narrow Query, Results, and Selection providers #91423

Closed

Description

@mountiny

Problem

The monolithic SearchContext combined query state, results/data, and selection state in a single context object. Any component that consumed even one field would re-render whenever any of those three axes changed, causing unnecessary re-renders across Search and related UI.

Solution

Split SearchContext into three narrow providers: SearchQueryProvider (query string and filter state), SearchResultsProvider (results data, loading, and sort config), and SearchSelectionProvider (selection set and bulk-action state). Migrated 90+ consumers to the matching narrow hooks (useSearchQuery, useSearchResults, useSearchSelection), removed the old shim and re-exports, and added SearchContextDefinitions.ts for shared types to avoid circular imports. The public Search component API is unchanged.

PR

#91303

Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. Pujan92 commented on Jun 2, 2026

    @Pujan92
    Contributor

    Looks like automation failed here, this is due for payment. @mountiny

  2. Pujan92 commented on Jun 3, 2026

    @Pujan92
    Contributor

    No checklist is needed, as it was a refactor task

  3. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    on Jun 3, 2026
  4. melvin-bot commented on Jun 3, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  5. mallenexpensify commented on Jun 4, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @Pujan92 due $250 via NewDot

  6. twisterdotcom commented on Jun 5, 2026

    @twisterdotcom
    Contributor

    $250 approved for @Pujan92 in Report ID: R00AmBWWwmKw.

    Zapier Logs Run ID: 00040eee-f02e-a27e-8602-65bee048df44

    SO: https://stackoverflowteams.com/c/expensify/questions/7582

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionReviewingHas a PR in reviewTaskWeeklyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions