ant-design / ant-design/pro-components

ProFormSelect 在 searchable 和 request 都设置的情况下,不能正确设置默认值

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

Description

ProFormSelect 在属性只有 options 且类型一致的情况下,能够正常设置默认值

但是如果是 searchable 和 request 的情况下,不能够设置默认值,也没有触发请求。

一般情况下,服务端返回的是 label 和 value,

一般的需求是输入 label 搜索值,设置 value ,且当前 ProFormSelect 的 name 值 一般也会 value 的属性,而不是对应 value 值。
例如:数据库字段为 type 作为 ProFormSelect 的 name , 但是搜索的值一般是中文,保存到服务段的也是 type 字段。这就导致,如果设置 type 的值,就不是要显示的值

Contributor guide

Open the contributing guide

Research direction

Reproduce ProFormSelect with searchable and request enabled, using a server-style label/value response and a default value. Compare it with the options-only case and verify whether the request is triggered and the matching label is displayed. Done means the default value is correctly resolved without changing the expected name/value behavior.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.