Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[material-ui] [Autocomplete] Add disableSearch to prevent local search #45512

Open
yermartee opened this issue Mar 7, 2025 · 0 comments
Open
Assignees
Labels
component: autocomplete This is the name of the generic UI component, not the React module! status: waiting for maintainer These issues haven't been looked at yet by a maintainer

Comments

@yermartee
Copy link
Contributor

yermartee commented Mar 7, 2025

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

@yermartee yermartee added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Mar 7, 2025
@yermartee yermartee changed the title [material-ui] [Autocomplete] Add disableSearch to prevent local search. [material-ui] [Autocomplete] Add disableSearch to prevent local search Mar 7, 2025
@zannager zannager added the component: autocomplete This is the name of the generic UI component, not the React module! label Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: autocomplete This is the name of the generic UI component, not the React module! status: waiting for maintainer These issues haven't been looked at yet by a maintainer
Projects
None yet
Development

No branches or pull requests

3 participants