question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Respect defaultInputValue when provided

See original GitHub issue

Hi, 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:closed
  • Created 5 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
EnoahNetzachcommented, Jun 18, 2018

agreed!

1reaction
EnoahNetzachcommented, Jun 18, 2018

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: screen shot 2018-06-18 at 17 55 48 even in the first render (here implemented by a pristine value in the state: screen shot 2018-06-18 at 17 58 17

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found