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

[Autocomplete] Multiple async selection + react-hook-form causes inconsistent view #44553

Open
Michele-Masciave opened this issue Nov 26, 2024 · 2 comments
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

@Michele-Masciave
Copy link

Michele-Masciave commented Nov 26, 2024

Steps to reproduce

Steps:

  1. Open this link to live example: https://codesandbox.io/p/sandbox/zlgt6x
  2. Type on the autocomplete
  3. Select some options

Current behavior

  1. The current text is not visible on typing
  2. The selected options are not visible as chips once selected

Expected behavior

  1. The current text is visible on typing
  2. The selected options are visible as chips once selected

Context

I'm implementing an async type ahead using the Autocomplete component and react-hook-form. While for the static standard/multiple implementation it was quite straight, I'm dealing with the following issue for the async multiple case.

The value looks not consistent between the Form and the view.
Besides the debounce logic that can be simplified, I tried also to save the selected values onChange in a new state to simultaneously maintain value and options, but I'm still not able to see the selected options in the autocomplete.

Your environment

Running on a nodebox.

react: 18.2
mui/material: 6.1.8
react-hook-form: 7.46.1
browser: Chrome (Version 131.0.6778.86 (Official Build) (64-bit))

Search keywords: autocomplete, multiple, react-hook-form

@Michele-Masciave Michele-Masciave added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Nov 26, 2024
@zannager zannager added the component: autocomplete This is the name of the generic UI component, not the React module! label Nov 26, 2024
@aarongarciah aarongarciah changed the title Multiple Autocomplete | async options on type | react-hook-form > inconsistent view [Autocomplete] Multiple async selection + react-hook-form Nov 26, 2024
@aarongarciah aarongarciah changed the title [Autocomplete] Multiple async selection + react-hook-form [Autocomplete] Multiple async selection + react-hook-form causes inconsistent view Nov 26, 2024
@Harsh517-tech415
Copy link

hey can you please assign this issue to me, still this i tried to solve it.
Thanks

@Harsh517-tech415
Copy link

Fixed
Text Visibility: The issue where the text wasn’t visible while typing was resolved by manually handling the inputValue in the onInputChange event.
Selected Chips: The issue where selected options weren’t displayed as chips was fixed by moving {params.InputProps.startAdornment} outside the condition in renderInput, ensuring chips are consistently visible.
You can check the updated behavior here: [Fixed Sandbox Link]

Let me know if you have any further questions!

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

4 participants