ant-design / ant-design/pro-components

🧐[问题]为什么当使用 ProFormSelect request 返回options时,指定的key并不生效,始终以value作为key

Open
#8,601 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
4.8k
Forks
1.4k
Avg merge
10h 44m
Merged PRs (30d)
3

Description

提问前先看看:

https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md

### 🧐 问题描述

ProFormSelect 组件使用 request 异步返回options时,并没有根据开发者指定的key作为react渲染的key,这个情况存在很久了,是有意为之吗,是否应该根据用户指定的key运行?

### 💻 示例代码

以用户传入的key为主,没有再取value

### 🚑 其他信息

截图如下
![image](https://github.com/user-attachments/assets/280c96e6-53a1-4266-ad55-1ee9fac60518)

Contributor guide

Open the contributing guide

Research direction

Start at the ProFormSelect component and reproduce the request-based options behavior described in the issue, checking how the supplied key and value are chosen for React rendering. The change is complete when a user-provided key is preferred over value for returned options; add or update coverage if the relevant test location is found.

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
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.