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.

Creatable: when `promptTextCreator` returns only the entered text, changes don't fire on first Enter key press

See original GitHub issue

When promptTextCreator of Creatable returns only the user-entered label, you can’t select the newly entered value on first Enter keypress, only the second one will trigger changes.

From what I managed to debug, this is due to the new entry being pushed into options prop somewhere along the way, and then failing the uniqueness check.

Minimal reproduction: https://github.com/tmikoss/react-select-creatable-bug-repro/blob/master/src/index.js (repo root is runnable, built by create-react-app).

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
JedWatsoncommented, Nov 19, 2017

Fixed by #2140

1reaction
tmikosscommented, Nov 9, 2017

For what it’s worth, I’m using (label) => `${label} ` as a workaround - looks the same to end-user, just makes for some weird code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-select Creatable: override default behavior upon ...
Currently whenever the user types something in and presses Enter key, it gets added as a new option. Is there a way to...
Read more >
@nubisoft/react-select - npm
The onChange event provides an array of selected options or a comma-separated string of values (eg "1,2,3" ) if simpleValue is true; By...
Read more >
Wrong event fires on text box enter key press - Telerik
I'm trying to fire the button click function while pressing enter on a text box. But the "delete" button in the grid fires...
Read more >
Modern React From The Beginning EP6: Event Handling
For this field you'll learn how to handle the Change and the KeyPressed event ... a new label and input field to component...
Read more >
Viewing online file analysis results for 'main_bundle.js'
... value, extra ) {\n\n\t\t// Don\'t set styles on text and comment ... promptTextCreator: function promptTextCreator(input) {\n return ...
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