Skip to content

[Creatable] Fix multiple clicks required to create new option#1471

Closed
billyvg wants to merge 44 commits intoJedWatson:masterfrom
billyvg:master
Closed

[Creatable] Fix multiple clicks required to create new option#1471
billyvg wants to merge 44 commits intoJedWatson:masterfrom
billyvg:master

Conversation

@billyvg
Copy link

@billyvg billyvg commented Jan 9, 2017

When you attempt to create a new option, it does not have a value property -- the "Create new label" option also does not have a value property, so isOptionUnique believes they are equal.

Is this the right place to handle the issue?

Fixes #1327

@coveralls
Copy link

Coverage Status

Coverage remained the same at 92.308% when pulling 4a0fc79 on billyvg:master into ef3a468 on JedWatson:master.

@JedWatson
Copy link
Owner

Can you provide a full usage example here? I can't reproduce the behaviour you're seeing.

I suspect you're using a custom newOptionCreator method that's not setting the value property on the new option, the default one sets both the value and the label property to the input value:

function newOptionCreator ({ label, labelKey, valueKey }) {
	const option = {};
	option[valueKey] = label;
 	option[labelKey] = label;
 	option.className = 'Select-create-option-placeholder';
 	return option;
};

@billyvg
Copy link
Author

billyvg commented Jan 31, 2017

That's correct, we have an option whose value as an empty string.

mcls and others added 25 commits May 5, 2017 15:31
readme now reflect fact that noResultsText can be a string or a react component
May not be desirable in the long term but adding it for now to simplify
things
The calls to setState should be batched, but this protects against an
edge-case where they may not be
@coveralls
Copy link

Coverage Status

Coverage increased (+0.4%) to 92.707% when pulling 90ea526 on billyvg:master into ef3a468 on JedWatson:master.

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.