react-component / react-component/select
Showing 0 instead of empty string in OptionsList
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 938
- Forks
- 482
- Avg merge
- 15h 8m
- Merged PRs (30d)
- 2
Description
In cases while Select had an Option with label '' (empty string) and value 0 the Select renders the 0

This hapens because of the code:
https://github.com/react-component/select/blob/824383d6f45b2de5cb432437ce8bd9d0704c6a6f/src/OptionList.tsx#L339-L341
For context: we had moved from our own ui-kit to Antd and in our ui-kit using the empty string was neccessary for resetting the select option
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue points to src/OptionList.tsx lines 339-341; start by inspecting the rendering path for an option whose label is empty and value is 0. Confirm that the select preserves the empty label rather than displaying 0, and add regression coverage for that case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100