ant-design / ant-design/pro-components

🐛[BUG] ProTable columns中配置valueType:'select' +request时,搜索完选中值后会触发一次新的搜索

Open
#8,780 4 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

### 🐛 bug 描述
在ProTable columns中配置了一个远程下拉搜索框
```javascript
{
title: '测试',
dataIndex: 'test',
hideInTable: true,
valueType: 'select',
request: async params => {
console.log(params)
const result = await fetchData({ name: params.keyWords || '' })

return result?.map(({ id: value, name: label }) => {
return { label, value }
})
},
defaultKeyWords: '',
fieldProps: {
showSearch: true,
placeholder: '请输入',
},
},
```

### 📷 复现步骤
1. 输入框搜索内容
2. 选中一个值

### 🏞 期望结果
选中值后不触发请求

### 💻 复现代码

https://codesandbox.io/p/sandbox/qgnx8z

### © 版本信息

- ProComponents 版本:2.6.42
- umi 版本 未使用
- 浏览器环境 Chrome 129
- 开发环境 macOS

### 🚑 其他信息

Contributor guide

Open the contributing guide

Research direction

Start with the ProTable column handling for valueType:'select' fields that use request, using the linked CodeSandbox to reproduce the behavior. Trace the request triggered during search and selection, then verify that selecting a value no longer causes an additional request.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.