-
-
Notifications
You must be signed in to change notification settings - Fork 369
Description
Feature request
Summary
Currently, clicking ComboboxClear sets value to undefined which causes issues if it is controlled component, React complains. Trying simple onChange conversion to empty string works for the error, but now ComboboxClear icon never goes away (I guess it checks if value === undefined to hide).
Workaround is to conditionally render ComboboxClear. But I feel adding all this extra checks and conversions is not optimal. I'm not sure what would be the best way to resolve this. Simplest would be maybe to make ComboboxClear icon visibility to also check for empty string, not just undefined.
Or maybe for ComboboxClear to set value to empty string instead? Not sure how this would affect other things, but undefined and controlled fields don't play well together.
Motivation
I'm looking for minimal/clean way to make combobox work in controlled mode in React forms (RHF, or tanstack form)