Respect defaultInputValue when provided
See original GitHub issueHi, thanks a lot for this UI-less solution: it’s been really easy to integrate with our existing UI lib as a substitution of a (really) old jQuery based one!
I’m having one single problem: I provide both a selectedItem
and a defaultInputValue
to downshift, and since inputValue
and selectedItem
are decoupled, I’d expect that in my initial rendering I would see defaultInputValue
.
In practice this snippet of code in the constructor:
if (state.selectedItem != null) {
state.inputValue = this.props.itemToString(state.selectedItem)
}
prevents that, effectively coupling the two fields.
I’d suggest to also check wether this.props.defaultInputValue
is null
in that if condition.
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (14 by maintainers)
Top Results From Across the Web
Respect defaultInputValue when provided · Issue #467 - GitHub
I'm having one single problem: I provide both a selectedItem and a defaultInputValue to downshift, and since inputValue and selectedItem are ...
Read more >API - React Select
A flexible and beautiful Select Input control for ReactJS with multiselect, autocomplete and ajax support.
Read more >The 'defaultInputValue' prop of AsyncSelect in react-select?
The 'defaultInputValue' prop on the initial render gets passed ... Try to make it controlled by providing value instead of defaultValue .
Read more >prompt User for nput with default input value - NI Community
Then right click on it and choose "Open Front Panel" and click "Convert" when asked. In the panel that appears, you'll see the...
Read more >useComboBox – React Aria - NET
Provides the behavior and accessibility implementation for a combo box component. ... with the default input text set by the defaultInputValue prop.
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 Free
Top 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
agreed!
Here a quick example.
I would like to maintain the decoupling you have when you’re changing the input, but the selected item doesn’t change yet:
even in the first render (here implemented by a 
pristine
value in the state: