react-component / react-component/select

当value 没有 label 属性时,并且options 不包含 value 时,应当将 value 作为 label

Open
#1,028 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

复现demo:

https://codesandbox.io/p/sandbox/amazing-ace-jvdx6j?file=%2FApp.tsx%3A46%2C30

复现步骤:

第一步: 设置 value 包含 label

 <Select value={{value: 'test', label: 'custom text'}} />

第二步:更新value 为 简单类型

 <Select value={'test'} />

预期表现:

第二步后,选择器内文字为 test

实际表现

第二步后,选择器内文字为上一次缓存的文案 custom text

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

Start with the linked CodeSandbox reproduction in App.tsx around line 46 and reproduce the transition from an object value with a label to the simple value "test". Trace how the Select chooses its displayed label when options do not contain the value; done means the display changes to "test" rather than retaining "custom text".

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.