react-component / react-component/select

Showing 0 instead of empty string in OptionsList

Open
#894 0 comments 0 reactions 0 assignees View on GitHub

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
image

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

  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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.