Cannot clear value manually (not truly controlled) when there is no match
See original GitHub issueIt seems that the component is not controlled when the search result is not a match of the options.
Example: https://plnkr.co/edit/b85HMDbt0jUZjkwCE7jG?p=preview
Using 1.0.0-rc.10
.
I use the component to do a complex search from a number of filters (react-select
being one of them). My external function is unable to clear the component by simply settings value={}
to the empty string/undefined/null.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:20 (8 by maintainers)
Top Results From Across the Web
Material-ui autocomplete clear value - reactjs - Stack Overflow
When I encountered this, it was when options for the autocomplete changed, and wanted to clear the input value.
Read more >MatchIt.pdf - R Project
Several matching methods require or can involve the distance between treated and control units. Options include the Mahalanobis distance, ...
Read more >REMOVE - Cypher Manual - Neo4j
Instead, if no value exists, the property is just not there. So, REMOVE is used to remove a property value from a node...
Read more >AbstractControl - Angular
A control is disabled when its status is DISABLED . Disabled controls are exempt from validation checks and are not included in the...
Read more >nuget.config File Reference - Microsoft Learn
You may need to configure clear elements to ensure no user or machine specific ... Passwords are encrypted and cannot be added manually....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @zivester you are right it’s never cleared out due to
inputValue
is still controlled within theSelect
component. This will be a harder bug to fix because we own the state withinputValue
.In regards to the value always being an object, you can pass in a
falsey
value or anobject
. Afalsey
value tells us that the value should be cleared.Hi @zivester the example you gave us includes some incorrect code.
The
onChange
handler should not bebut
The reason is because you are still passing in an object and we don’t do a diff to check if all of the values on the object are empty.