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

Use accessor props to get value and label in compareOption #4444

Merged
merged 2 commits into from
Feb 18, 2021

Conversation

Rall3n
Copy link
Collaborator

@Rall3n Rall3n commented Feb 10, 2021

By default the compareOption internal function for the Creatable component defaults to using the value and label properties of options to resolve and find options matching a search string. Besides getOptionLabel and getOptionValue people would have to also use the isValidNewOption prop to accommodate for their custom options.

This PR forwards the values of the accessor props getOptionLabel and getOptionValue to the compareOption function to allow for the usage of custom options without the need to overwrite the default isValidNewOption function.

There was PR #2956 which tried to do the same but failed in using the proper functions (defaulted to hardcoded built-ins).

@changeset-bot
Copy link

changeset-bot bot commented Feb 10, 2021

🦋 Changeset detected

Latest commit: 2ffed9c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
react-select Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codesandbox-ci
Copy link

codesandbox-ci bot commented Feb 10, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 2ffed9c:

Sandbox Source
react-codesandboxer-example Configuration

@JedWatson JedWatson added this to the 4.2 milestone Feb 10, 2021
@JedWatson JedWatson merged commit 88cb46a into JedWatson:master Feb 18, 2021
@JedWatson
Copy link
Owner

Thanks @Rall3n!

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.

None yet

2 participants