[material-ui] [Autocomplete] Add `disableSearch` to prevent local search
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 99.1k
- Forks
- 32.5k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 106
Description
Summary
Hi there,
The Autocomplete component currently lacks the ability to disable its built-in local search functionality.
This behavior becomes problematic in scenarios where backend APIs handle all search and filtering, as it leads to unnecessary processing and potential data discrepancies.
To address this, I suggest introducing a new disableSearch prop. When set to true, this prop would completely prevent the component from performing any local search, allowing developers to rely entirely on backend-driven search and filtering logic.
This feature would improve performance, ensure data consistency, and provide a more elegant solution compared to workarounds like overriding filterOptions.
Examples
Scenario:
- The Autocomplete component has a built-in local search that filters results based on user input.
- The backend API already handles search and filtering with a custom logic (e.g., fuzzy search, partial matches, or case-insensitive search).
- The response from the backend is already filtered, but the Autocomplete component re-filters the results locally, causing issues.
Motivation
I suggest a new feature for the Autocomplete component: the ability to fully disable local search.
By implementing full support for disableSearch: true, developers can rely entirely on backend search and filtering, improving both performance and data consistency.
Currently, I’m addressing this issue by using:
filterOptions={(options) => options} // No need to filter options; we handle it on the server
However, I believe a more elegant solution would be to introduce a dedicated disableSearch prop.
I’d be happy to open a PR to implement this feature.
Search keywords: Autocomplete, LocalSearch, Input
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the Autocomplete component and its existing filterOptions behavior; compare how the component handles locally filtered options with the proposed disableSearch prop. Define the expected behavior for backend-filtered results and verify it against the existing Autocomplete examples or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100