Creatable: when `promptTextCreator` returns only the entered text, changes don't fire on first Enter key press
See original GitHub issueWhen 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:
- Created 6 years ago
- Comments:5 (1 by maintainers)
Top 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 >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
Fixed by #2140
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.