react-select icon indicating copy to clipboard operation
react-select copied to clipboard

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

Open tmikoss opened this issue 9 years ago • 5 comments

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).

tmikoss avatar Nov 01 '17 05:11 tmikoss

Faced the same issue.

alexanderzobnin avatar Nov 02 '17 15:11 alexanderzobnin

+1 on this one

thebalkanfella avatar Nov 09 '17 10:11 thebalkanfella

yeah, the issue is a pretty annoying one

Khvalin avatar Nov 09 '17 15:11 Khvalin

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.

tmikoss avatar Nov 09 '17 16:11 tmikoss

Fixed by #2140

JedWatson avatar Nov 19 '17 22:11 JedWatson