Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should Creatable be mutating its options prop? #1793

Closed
ericchernuka opened this issue Jun 16, 2017 · 1 comment
Closed

Should Creatable be mutating its options prop? #1793

ericchernuka opened this issue Jun 16, 2017 · 1 comment

Comments

@ericchernuka
Copy link

Mostly a question on the rationale for Creatable mutating the options prop when a new tag is added, but a onNewOptionClick is not defined. Currently on the examples site the options from state are directly mutated which seems like a bad idea.

The code below from Creatable (https://github.com/JedWatson/react-select/blob/master/src/Creatable.js#L95) shows the mutation:

if (isOptionUnique) {
	if (onNewOptionClick) {
		onNewOptionClick(option);
	} else {
		options.unshift(option);

		this.select.selectValue(option);
	}
}

Was this intentional or was it for those using things like MobX?

@agirton
Copy link
Collaborator

agirton commented Jun 19, 2017

Hi @ericchernuka this is a duplicate of #1477 you can follow the discussion there.

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

No branches or pull requests

2 participants