JedWatson / JedWatson/react-select

getOptionValue is called with wrong type

Open
#5,899 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

issue/bug-unconfirmed
Dominant language
TypeScript
Stars
28k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

Thanks for using react-select!

If you are going to ask a question or want to propose a change or a new feature, then please don't file an issue for this.
Questions and feature requests have their own place in our discussions section.

Are you reporting a bug or runtime error?

react-select v5.8.0
react v18.2.0

I'm trying to use Creatable with getOptionLabel and getOptionValue. But when the "create ..." item wants to be shown, my getOptionValue is called with an unexpected input (I expect my own data type, but it is a string: 'Create item ...')

So, If I type something that does not exist in the options list, the "Create ..." label is not shown, instead it shows empty line.

image

Forked PoC: CodeSandbox

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the behavior from the linked CodeSandbox, starting with its /index.js Creatable example and custom getOptionLabel/getOptionValue callbacks. Trace the Creatable rendering path in the repository and locate relevant tests; done means the create option displays correctly without passing an unexpected string to the callback, with regression coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.