Skip to content

SearchProvider rebuilds the search index for every query #1249

Description

@avinxshKD

Problem

SearchProvider fetches and rebuilds the full Fuse search index every time the submitted search term changes. Entering multiple queries causes repeated requests for the same locale JSON and repeatedly performs the expensive flattening and indexing work.

Because requests are not cancelled, an older locale response can also finish after a newer one and overwrite the active search index.

Steps to reproduce

  1. Open /search/ and the browser network panel.
  2. Submit multiple search terms.
  3. Observe repeated requests for the same file under /search-indices/.

Expected behavior

  • Fetch and build the Fuse index only when the locale changes.
  • Reuse that index for subsequent submitted searches.
  • Clear the previous locale's index while its replacement loads.
  • Abort an in-flight index request when the locale changes or the component unmounts.

File

src/components/SearchProvider/index.tsx

Activity

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

Metadata

Metadata

Assignees

Labels

BugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions