Skip to content

Creatable: when promptTextCreator returns only the label, changes don't fire on first Enter key press#2140

Merged
JedWatson merged 1 commit intoJedWatson:masterfrom
karaggeorge:prompt-text-creator-label-bug
Nov 19, 2017
Merged

Creatable: when promptTextCreator returns only the label, changes don't fire on first Enter key press#2140
JedWatson merged 1 commit intoJedWatson:masterfrom
karaggeorge:prompt-text-creator-label-bug

Conversation

@karaggeorge
Copy link
Contributor

@karaggeorge karaggeorge commented Nov 10, 2017

This PR solves this issue: #2125

Bug can be seen here: https://plnkr.co/edit/lC6lJuAYaTItCSJxTjnD?p=preview

Reason

It was caused because when creating a new choice, there is a check to see if the option is unique (even though there is a check for that to even display the new option creator). This check was checking the value against a list of filtered options. This filter was the passed down filter prop and was basically checking the option against itself with the addition of the prompt text. Therefore, by accident if there was a prompt text it was passing, but when using (label) => label, it was failing.

Solution

It has been fixed to check against the list of options available.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 94.586% when pulling a75d9ae on karaggeorge:prompt-text-creator-label-bug into 6cc59dd on JedWatson:master.

@karaggeorge karaggeorge changed the title Creatable: when promptTextCreator returns only the entered text, changes don't fire on first Enter key press Creatable: when promptTextCreator returns only the label, changes don't fire on first Enter key press Nov 10, 2017
@JedWatson
Copy link
Owner

Great, thanks @karaggeorge

👍 props for both the fix and explanation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants